Файл: public_html/cron/sbros_every_24hour.php
Строк: 236
<?
session_start();
define('PROTECTOR', 1);
$start_cron_time=microtime(true);
@include('../files/db.php');
{
$time = time();
$date = date("d:M:y");
$sbros = @mysql_fetch_array( @mysql_query_new("SELECT * FROM `sbros` LIMIT 1"));
if($sbros['time']<=time()){ $StatusObnuleniya='active';}else{$StatusObnuleniya = 'DIE';}
if($StatusObnuleniya=='active'){
$req = @mysql_query_new("SELECT * FROM `district`");
while($asd = @mysql_fetch_array($req)){
$Clan_Rul = @mysql_fetch_array( @mysql_query_new("SELECT * FROM `district_clans` WHERE `district`='$asd[id]' ORDER BY `district_auth` DESC LIMIT 1"));
@mysql_query_new("INSERT `district_domination` SET
`district`='$asd[id]',
`clan_id`='$Clan_Rul[clan_id]',
`district_auth`='$Clan_Rul[district_auth]',
`time`='". time() ."'
");
}
$sum_gang_auth_aa = @mysql_fetch_array( @mysql_query_new("SELECT SUM(gang_auth_day) AS `gang_auth_day` FROM `clans` WHERE `storona`='aa'"));
$sum_gang_auth_ru = @mysql_fetch_array( @mysql_query_new("SELECT SUM(gang_auth_day) AS `gang_auth_day` FROM `clans` WHERE `storona`='ru'"));
$sum_gang_auth_la = @mysql_fetch_array( @mysql_query_new("SELECT SUM(gang_auth_day) AS `gang_auth_day` FROM `clans` WHERE `storona`='la'"));
$sum_gang_auth_ch = @mysql_fetch_array( @mysql_query_new("SELECT SUM(gang_auth_day) AS `gang_auth_day` FROM `clans` WHERE `storona`='ch'"));
$sum_gang_auth_me = @mysql_fetch_array( @mysql_query_new("SELECT SUM(gang_auth_day) AS `gang_auth_day` FROM `clans` WHERE `storona`='me'"));
$sum_gang_auth_si = @mysql_fetch_array( @mysql_query_new("SELECT SUM(gang_auth_day) AS `gang_auth_day` FROM `clans` WHERE `storona`='si'"));
$gang_auth_day_aa = @mysql_fetch_array( @mysql_query_new("SELECT gang_auth_day,id FROM `clans` WHERE `storona`='aa' ORDER BY `gang_auth_day` DESC LIMIT 1"));
$gang_auth_day_ru = @mysql_fetch_array( @mysql_query_new("SELECT gang_auth_day,id FROM `clans` WHERE `storona`='ru' ORDER BY `gang_auth_day` DESC LIMIT 1"));
$gang_auth_day_la = @mysql_fetch_array( @mysql_query_new("SELECT gang_auth_day,id FROM `clans` WHERE `storona`='la' ORDER BY `gang_auth_day` DESC LIMIT 1"));
$gang_auth_day_ch = @mysql_fetch_array( @mysql_query_new("SELECT gang_auth_day,id FROM `clans` WHERE `storona`='ch' ORDER BY `gang_auth_day` DESC LIMIT 1"));
$gang_auth_day_me = @mysql_fetch_array( @mysql_query_new("SELECT gang_auth_day,id FROM `clans` WHERE `storona`='me' ORDER BY `gang_auth_day` DESC LIMIT 1"));
$gang_auth_day_si = @mysql_fetch_array( @mysql_query_new("SELECT gang_auth_day,id FROM `clans` WHERE `storona`='si' ORDER BY `gang_auth_day` DESC LIMIT 1"));
$_max_domination=max(
$sum_gang_auth_aa['gang_auth_day'],
$sum_gang_auth_ru['gang_auth_day'],
$sum_gang_auth_la['gang_auth_day'],
$sum_gang_auth_ch['gang_auth_day'],
$sum_gang_auth_me['gang_auth_day'],
$sum_gang_auth_si['gang_auth_day']);
$array_domination= array(
"$sum_gang_auth_aa[gang_auth_day]"=>'aa',
"$sum_gang_auth_ru[gang_auth_day]"=>'ru',
"$sum_gang_auth_la[gang_auth_day]"=>'la',
"$sum_gang_auth_ch[gang_auth_day]"=>'ch',
"$sum_gang_auth_me[gang_auth_day]"=>'me',
"$sum_gang_auth_si[gang_auth_day]"=>'si');
$array_req_domination=$array_domination["$_max_domination"];
@mysql_query_new("INSERT INTO `domination` SET
`dom` = '$array_req_domination',
`aa` = '$sum_gang_auth_aa[gang_auth_day]',
`ru` = '$sum_gang_auth_ru[gang_auth_day]',
`la` = '$sum_gang_auth_la[gang_auth_day]',
`ch` = '$sum_gang_auth_ch[gang_auth_day]',
`me` = '$sum_gang_auth_me[gang_auth_day]',
`si` = '$sum_gang_auth_si[gang_auth_day]',
`clan_aa` = '$gang_auth_day_aa[id]',
`clan_ru` = '$gang_auth_day_ru[id]',
`clan_la` = '$gang_auth_day_la[id]',
`clan_ch` = '$gang_auth_day_ch[id]',
`clan_me` = '$gang_auth_day_me[id]',
`clan_si` = '$gang_auth_day_si[id]',
`time`='".($time+3600)."'");
$resul_liders_clans_while= @mysql_query_new("SELECT * FROM `clans`");
while($res_liders_clans= @mysql_fetch_assoc($resul_liders_clans_while))
{ @mysql_query_new("UPDATE `stats_users` SET `kolvo`=`kolvo`+'1' WHERE `usr`='$res_liders_clans[lider]' and `stats_quest_id`='6'"); }
@mysql_query_new("UPDATE `clans` SET `gang_auth_day`='0'");
@mysql_query_new("UPDATE `clan_users` SET `gang_auth_day`='0'");
@mysql_query_new("UPDATE `boi` SET `gang_auth_day`='0',`boi_uron_lvl`='0'");
@mysql_query_new("UPDATE `bonus` SET `kolvo`='0' WHERE `tip`='uron' and `prim`='uron_boi_day'");
@mysql_query_new("UPDATE `messages` SET `delete_komy`='1', `save_komy`='0' WHERE `ot`='$admin_set[support]'");
@mysql_query_new("UPDATE `messages` SET `delete_ot`='1' WHERE `time`<'".($time-(3600*24*31))."' and `save_ot`='0' and `read`='1'");
@mysql_query_new("UPDATE `messages` SET `delete_ot`='1' WHERE `time`<'".($time-(3600*24*31))."' and `save_ot`='0' and `read`='0'");
@mysql_query_new("UPDATE `messages` SET `delete_komy`='1' WHERE `time`<'".($time-(3600*24*365))."' and `save_komy`='0' and `read`='1'");
@mysql_query_new("UPDATE `messages` SET `delete_komy`='1' WHERE `time`<'".($time-(3600*24*31))."' and `save_komy`='0' and `read`='0'");
// @mysql_query_new("DELETE FROM `messages` WHERE `delete_komy`='1' and `delete_ot`='1' and `time`<'".($time-(3600*24*31*3))."'");
@mysql_query_new("DELETE FROM `userquests_id` WHERE `tip`='everyday' and `status`='0'");
@mysql_query_new("DELETE FROM `userquests` WHERE `tip`='everyday' and `status`='0'");
@mysql_query_new("DELETE FROM `bonus` WHERE `time`<'$time'");
@mysql_query_new("DELETE FROM `logs` WHERE `time`<'".($time-(3600*24*31))."'");
@mysql_query_new("DELETE FROM `komentarai` WHERE `time`<'".($time-(3600*24*365*3))."' and `admin`!='1' and `delete`='1'");
@mysql_query_new("UPDATE `komentarai` SET `delete`='1' WHERE `time`<'".($time-(3600*24*14))."' and `admin`!='1'");
@mysql_query_new("UPDATE `komentarai` SET `delete`='1' WHERE `time`<'".($time-(3600*24*7))."' and `bot`='1'");
@mysql_query_new("UPDATE `sbros` SET `time`=`time`+'".(3600*24)."'");
}
}
############
############
############
$time = time();
$sbros = @mysql_fetch_array( @mysql_query_new("SELECT * FROM `sbros` LIMIT 1"));
echo"
<!DOCTYPE html PUBLIC '-//WAPFORUM//DTD XHTML Mobile 1.0//EN' 'http://www.wapforum.org/DTD/xhtml-mobile10.dtd'>
<title>Игра $Name_Game </title>
<link rel='stylesheet' href='/theme/css/light.css' type='text/css'>
<h1 class='center mt5'> CRON-Задача </h1>
<div class='border-top'></div>
<div class='inner-content'>
<h1 class='center' style='color: #CE1616;'> Ежедневное обнуления </h1>
</div>
<div class='border-top'></div>
<div class='inner-content'>
До следующего: <b>".date("(H:i:s)ч.",$sbros['time']-$time-(3*3600))."</b> <br>
Статус: [<b>$StatusObnuleniya</b>] <br>
<a href='/index.php?r=index' class='bttn_sea'> На главную </a>
</div>
<div class='border-top'></div>
<div class='html'>
© 2016 «ZEBEST Inc.» 16+ <br>
".mb_substr((microtime(true)-$start_cron_time), 0, 5)." сек.
</div>
";
?>