<?php
Error_reporting(0);
Error_reporting(E_WARNING | E_ERROR);
require_once 'cron_settings.php';
Echo 'sss';
Echo round(1*35.6);
if (isset($_GET['password']) && $_GET['password'] == $cron_password) {
Echo '1';
$clans = mysql_query("SELECT * FROM `clans`");
while ($clan = mysql_fetch_assoc($clans)) {
// b - building
$clan_buildings = mysql_query("SELECT * FROM `clan_buildings` WHERE `clan_id` = '$clan[id]'");
while ($building = mysql_fetch_assoc($clan_buildings)) {
mysql_query("Update `clan_buildings` Set `builded` = '1', `bonus` = '".getBuildingBonus($building['level'], $building['type'])."', `level` = `level` + 1, `time_left` = '0' WHERE `builded` = '0' AND `time_left` < '".time()."' AND `time_left` != '0'");
}
$clan_users = mysql_query("SELECT * FROM `user` WHERE `clan_id` = '".$clan['id']."'");
while ($player = mysql_fetch_assoc($clan_users)) {
if (mysql_result(mysql_query("SELECT Count(*) FROM `clan_buildings` WHERE `clan_id` = '".$player['clan_id']."' AND `type` = 'param_perc_bonus' AND `bonus` > '0'"),0) == true) {
$param_perc_bonus = mysql_fetch_assoc(mysql_query("SELECT * FROM `clan_buildings` WHERE `clan_id` = '".$player['clan_id']."' AND `type` = 'param_perc_bonus'"));
$param_bonus = $param_perc_bonus['bonus'];
$param_bonus = round($param_bonus/2);
mysql_query("UPDATE `user` SET `sila` = '".($player['sila']/100*$param_bonus+$player['sila'])."', `max_health` = '".($player['max_health']/100*$param_bonus+$player['health'])."', `lovk` = '".($player['lovk']/100*$param_bonus+$player['lovk'])."' WHERE `id` = '".$player['id']."'");
mysql_query("UPDATE `user` SET `zashit` = '".($player['zashit']/100*$param_bonus+$player['zashit'])."' WHERE `id` = '".$player['id']."'");
}
}
}
}
?>