Файл: tankon.mobi/clans1.php
Строк: 109
<?
@mysql_connect('localhost', 'tankon', '385331581631vbnvb');
@mysql_select_db('tankon');
@mysql_set_charset('utf8');
$time_bitva=time();
$bitva = mysql_query("SELECT * FROM `tanks_wartournament` WHERE `konec`='0' AND `time`<'".$time_bitva."'");
while($bitvas = mysql_fetch_array($bitva)) {
$napad=mysql_result(mysql_query("SELECT COUNT(*) FROM `tanks_wartournament_users` WHERE `tour` = '".$bitvas['id']."' AND `clan` = '".$bitvas['napad']."'"),0);
$zakaz=mysql_result(mysql_query("SELECT COUNT(*) FROM `tanks_wartournament_users` WHERE `tour` = '".$bitvas['id']."' AND `clan` = '".$bitvas['zakaz']."'"),0);
if($napad>1 && $zakaz>1 ){
mysql_query("UPDATE `tanks_wartournament` SET `konec`='1' WHERE `id`='".$bitvas['id']."'");
$t_bitva=$time_bitva+3600;
mysql_query("UPDATE `tanks_wartournament` SET `time`='".$t_bitva."' WHERE `id`='".$bitvas['id']."'");
}
elseif($napad>1 && $zakaz<2){
mysql_query("UPDATE `tanks_wartournament` SET `konec`='2', `win`='".$bitvas['napad']."',`time`='0' WHERE `id`='".$bitvas['id']."'");
mysql_query("UPDATE `tanks` SET `wartour`='0' WHERE `wartour`='".$bitvas['id']."'");
mysql_query("UPDATE `collective` SET `zolota`=`zolota`+'150' WHERE `id`='".$bitvas['napad']."'");
mysql_query("UPDATE `collective` SET `rating`=`rating`+'1000000' WHERE `id`='".$bitvas['napad']."'");
mysql_query("UPDATE `tanks_wartournament_users` SET `vkl`='1' WHERE `tour`='".$bitvas ['id']."'");
}
elseif($zakaz>1 && $napad<2){
mysql_query("UPDATE `tanks_wartournament` SET `konec`='2', `win`='".$bitvas['zakaz']."',`time`='0' WHERE `id`='".$bitvas['id']."'");
mysql_query("UPDATE `tanks` SET `wartour`='0' WHERE `wartour`='".$bitvas['id']."'");
mysql_query("UPDATE `collective` SET `zolota`=`zolota`+'150' WHERE `id`='".$bitvas['zakaz']."'");
mysql_query("UPDATE `collective` SET `rating`=`rating`+'1000000' WHERE `id`='".$bitvas['zakaz']."'");
mysql_query("UPDATE `tanks_wartournament_users` SET `vkl`='1' WHERE `tour`='".$bitvas ['id']."'");
}
elseif($zakaz<2 && $napad<2){
mysql_query("UPDATE `tanks_wartournament` SET `konec`='2',`time`='0' WHERE `id`='".$bitvas['id']."'");
mysql_query("UPDATE `tanks` SET `wartour`='0' WHERE `wartour`='".$bitvas['id']."'");
mysql_query("UPDATE `collective` SET `rating`=`rating`+'100000' WHERE `id`='".$bitvas['zakaz']."'");
mysql_query("UPDATE `collective` SET `rating`=`rating`+'100000' WHERE `id`='".$bitvas['napad']."'");
mysql_query("UPDATE `tanks_wartournament_users` SET `vkl`='1' WHERE `tour`='".$bitvas ['id']."'");
}
}
$bitvak = mysql_query("SELECT * FROM `tanks_wartournament` WHERE `konec`='1' AND `time`<'".$time_bitva."'");
while($bitvaks = mysql_fetch_array($bitvak)) {
mysql_query("UPDATE `tanks_wartournament` SET `konec`='2' WHERE `id`='".$bitvaks['id']."'");
mysql_query("UPDATE `tanks` SET `wartour`='0' WHERE `wartour`='".$bitvaks['id']."'");
if($bitvaks['napad_b']>$bitvaks['zakaz_b']){
mysql_query("UPDATE `tanks_wartournament` SET `win`='".$bitvaks['napad']."',`time`='0' WHERE `id`='".$bitvaks['id']."'");
mysql_query("UPDATE `collective` SET `zolota`=`zolota`+'150' WHERE `id`='".$bitvaks['napad']."'");
mysql_query("UPDATE `collective` SET `rating`=`rating`+'1000000' WHERE `id`='".$bitvaks['napad']."'");
} elseif($bitvaks['zakaz_b']>$bitvaks['napad_b']){
mysql_query("UPDATE `tanks_wartournament` SET `win`='".$bitvaks['zakaz']."',`time`='0' WHERE `id`='".$bitvaks['id']."'");
mysql_query("UPDATE `collective` SET `zolota`=`zolota`+'150' WHERE `id`='".$bitvaks['zakaz']."'");
mysql_query("UPDATE `collective` SET `rating`=`rating`+'1000000' WHERE `id`='".$bitvaks['zakaz']."'");
}
elseif($bitvaks['zakaz_b']==$bitvaks['napad_b']){
mysql_query("UPDATE `tanks_wartournament` SET `time`='0' WHERE `id`='".$bitvaks['id']."'");
mysql_query("UPDATE `collective` SET `rating`=`rating`+'100000' WHERE `id`='".$bitvaks['zakaz']."'");
mysql_query("UPDATE `collective` SET `rating`=`rating`+'100000' WHERE `id`='".$bitvaks['napad']."'");
}
mysql_query("UPDATE `tanks_wartournament_users` SET `vkl`='1' WHERE `tour`='".$bitvaks ['id']."'");
}
?>