battles/admin/reset_clan_rates.php
2019-01-16 19:45:30 +02:00

29 lines
1.1 KiB
PHP

<?
/**
* Copyright (c) 2018.
* Author: Igor Barkov <lopar.4ever@gmail.com>
* Project name: Battles-Game
*/
require_once "../functions.php";
$id = mysql_query("SELECT * FROM `clans`");
$clans = mysql_num_rows($id);
$check = 0;
while($check++ < $clans) {
$shor = mysql_fetch_array(mysql_query("SELECT * FROM `clans` WHERE `id` = '{$check}' LIMIT 1"));
$short = $shor['short'];
$exp = mysql_fetch_row(mysql_query("SELECT `exp`, COUNT(*) FROM `users` WHERE `klan` = '{$short}'"));
$id = mysql_query("SELECT `id` FROM `users` WHERE `klan` = '{$short}'");
$kolvo_us = mysql_num_rows($id);
echo "$exp[0];||$kolvo_us Q";
$site_r_clan = 0; // рейтинг клан сайта
$fight_r_clan = 0; // боевой рейтинг клана
$grash_point = 0; // очки гражданства
$Clan_ration = (($exp/$kolvo_us)+($site_r_clan*100000))+$fight_r_clan+$grash_point;
$l_p = mysql_query("UPDATE `clans` SET `rating` = 'Clan_ration' WHERE `id` = '{$check}'");
if($l_p) {
echo "Клановый рейтинг для клана '$short' удачно обновлен";
}
}