battles/admin/reset_clan_rates.php

29 lines
1.1 KiB
PHP
Raw Normal View History

2018-01-28 16:40:49 +00:00
<?
2018-12-12 23:37:27 +00:00
/**
* Copyright (c) 2018.
* Author: Igor Barkov <lopar.4ever@gmail.com>
* Project name: Battles-Game
*/
require_once "../functions.php";
2018-01-28 16:40:49 +00:00
$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' удачно обновлен";
}
}
?>