Файл: tankon.mobi/tanks/clan_battle.php
Строк: 263
<?php
if(isset($_GET['id'])){
$tournament = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_wartournament` WHERE `id`='".intval($_GET['id'])."' AND `konec`='0'"));
$tour_your_clan= mysql_fetch_array(mysql_query("SELECT * FROM `tanks_wartournament` WHERE `napad`='".$mc['id']."' OR `zakaz`='".$mc['id']."' AND `konec`='0' ORDER BY id DESC"));
if($tour_your_clan['id']==$_GET['id']){
if ($tanks_code['tank']>0){
$kol_playk = mysql_result(mysql_query("SELECT COUNT(*) FROM `tanks_wartournament_users` WHERE `tour` = '".intval($_GET['id'])."' AND `clan` = '".$mc['id']."'"), 0);
if($kol_playk<15){
if ($tanks_code['wartour']!=0){err_game('Можно участвовать только в одной высадке!');}else {
$ataka=atack($tanks_code['id']);
$bron=bron($tanks_code['id']);
$toch=toch($tanks_code['id']);
$proch=proch($tanks_code['id']);
mysql_query("INSERT INTO `tanks_wartournament_users` (`user`,`tanks`,`ataka`,`bron`,`toch`,`proch`,`twofuel`,`tour`,`clan`) VALUES ('$tanks_code[id_u]','$tanks_code[tank]','$ataka','$bron','$toch','$proch','0','$tournament[id]','$mc[id]')");
mysql_query("UPDATE `tanks` SET `wartour`='".$tournament['id']."' WHERE `id_u`='".$user['id']."' ");
header ("Location: /myclan?battle");}
}else {err_game('Все места заняты!');}
}else {err_game('Выберите танк для участия!');}
}else {err_game('У вас нет такой высадки!');}
}
elseif(isset($_GET['del'])){
mysql_query("DELETE FROM `tanks_wartournament_users` WHERE `tour` = '".$tanks_code['wartour']."' AND `user` = '".$tanks_code['id']."'");
mysql_query("UPDATE `tanks` SET `wartour`='0' WHERE `id`='".$user['id']."' ");
header ("Location: /myclan?battle");
}
elseif(isset($_GET['vis']) && $_GET['vis']!=0){
if(isset($_GET['delete']) && $mcu['status']==1){
$nkss_del = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_wartournament_users` WHERE `tour` = '".intval($_GET['vis'])."' AND `clan`='".$mc['id']."' AND `id`='".intval($_GET['delete'])."'"));
mysql_query("UPDATE `tanks` SET `wartour`='0' WHERE `id`='".$nkss_del['user']."' ");
mysql_query("DELETE FROM `tanks_wartournament_users` WHERE `tour` = '".intval($_GET['vis'])."' AND `clan`='".$mc['id']."' AND `id`='".intval($_GET['delete'])."'");
header ("Location: /myclan?battle&vis=17");
}
$tour_win= mysql_query("SELECT * FROM `tanks_wartournament_users` where `tour`='".intval($_GET['vis'])."' AND `clan`='".$mc['id']."' ORDER BY id DESC");
echo'<div class="trnt-block p5" style="margin-bottom:5px;"><div class="medium white bold cntr">Ваша команда</div></div>';
while($tour_wins = mysql_fetch_array($tour_win)) {
$win_good = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_wartournament` WHERE `id`='".$tour_wins['tour']."'"));
$tankss_wins = mysql_fetch_array(mysql_query("SELECT * FROM `tanks` WHERE `id_u`='".$tour_wins['user']."'"));
$tanksss_wins = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='".$tankss_wins['id']."'"));
$battle_lin = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_magazin` WHERE `id`='".$tankss_wins['tank']."'"));
if($mcu['status']==1){
echo'<table><tbody><tr><td>';}
echo'<a href="/profile?id='.$tanksss_wins['id'].'"><div class="trnt-block p5" style="margin-bottom:5px;">';
echo'<div class="small white bold">'.$tanksss_wins['nick'].'</div>
<div class="small green1 bold">'.$battle_lin['name'].'</div></div></a>';
if($mcu['status']==1){
echo'</td><td style="width:40px;">';
echo'<a href="/myclan?battle&vis='.$win_good['id'].'&delete='.$tour_wins['id'].'"><img src="/tanks/images/del_batt.png"></a>';
echo'</td></tr></tbody></table>';}
}
echo'<a class="simple-but gray" href="/myclan?battle"><span><span>Назад</span></span></a></div>';
include_once 'foots.php';
exit;
}
echo'<a class="simple-but blue" href="/faq?action=visad"><span><span>Правила высадок</span></span></a>';
$tour_you = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_wartournament_users` WHERE `user`='".$tanks_code['id']."' AND `vkl`='0'"));
$in_tour_you = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_wartournament` WHERE `id`='".$tour_you['tour']."' "));
if($in_tour_you['konec']==1){header ("Location: warclan?id=".$in_tour_you['id']."");}
$tour= mysql_query("SELECT * FROM `tanks_wartournament` WHERE `napad`='".$mc['id']."' OR `zakaz`='".$mc['id']."' ORDER BY id DESC");
while($tours = mysql_fetch_array($tour)) {
$you_tour = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_wartournament_users` WHERE `user`='".$tanks_code['id']."'"));
$in_tour = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_wartournament` WHERE `id`='".$you_tour['tour']."'"));
$in_tours = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_wartournament` WHERE `id`='".$tours['id']."'"));
if ($tanks_code['wartour']==0){echo '<div class="trnt-block" style="margin-bottom:0px">';}
elseif($tanks_code['wartour']==$tours['id'] && $in_tours['konec']==0){echo '<div class="trnt-block" style="border:2px solid #104E8B;width:98%;margin-left:2px;margin-bottom:0px">';}
elseif($tours['konec']==2 && $tanks_code['wartour']==0){echo '<div class="trnt-block" style="margin-bottom:3px">';}
else{echo '<div class="trnt-block" style="margin-bottom:5px">';}
$kol_play = mysql_result(mysql_query("SELECT COUNT(*) FROM `tanks_wartournament_users` WHERE `tour` = '".$tours['id']."' AND `clan` = '".$mc['id']."'"), 0);
$kol_plays = mysql_result(mysql_query("SELECT COUNT(*) FROM `tanks_wartournament_users` WHERE `tour` = '".$tours['id']."' AND `clan` != '".$mc['id']."'"), 0);
$time_battle=time_left($tours['time']-$time);
echo'
<div class="wrap1 p5">
<div class=" inbl">
<div class="thumb fl">
<img src="/tanks/images/tour/1.png"">
<span class="mask2"> </span>
</div>
<div class="ml58 small white sh_b bold">
Битва с кланом
';
if($mc['id']==$tours['napad']){
$colls = mysql_fetch_array(mysql_query("SELECT * FROM `collective` WHERE `id`='".$tours['zakaz']."'"));
echo' '.$colls['name'].' ';
}else{
$colls = mysql_fetch_array(mysql_query("SELECT * FROM `collective` WHERE `id`='".$tours['napad']."'"));
echo' '.$colls['name'].' ';
}
if($tours['konec']==1){echo'<span class="green2">началась</span>';}
elseif($tours['konec']==2){echo'<span class="green2">кончилась</span>';}
elseif($tours['konec']==0 && $tours['time']>time()){echo'примерно <span class="green2">'.$time_battle.'</span>';}
elseif($tours['konec']==0 && $tours['time']<time()){echo'<span class="green2">секунды на сборы</span>';}
echo'<br>Игроков: <span class="green2">'.$kol_play.':'.$kol_plays.'</span><br>
о призе читайте в правилах';
echo'
</div></div></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>';
$kol_playks = mysql_result(mysql_query("SELECT COUNT(*) FROM `tanks_wartournament_users` WHERE `tour` = '".$tours['id']."' AND `clan` = '".$mc['id']."'"), 0);
if($tanks_code['wartour']==0 && $tours['konec']==0){
echo'<table><tbody><tr><td class="w50"><a class="simple-but border" href="/myclan?battle&id='.$tours['id'].'" style="margin-bottom:3px;margin-top:3px;">
<span><span>За честь клана</span></span></a></td>
<td class="w50"><a class="simple-but border" href="/myclan?battle&vis='.$tours['id'].'" style="margin-bottom:3px;margin-top:3px;">
<span><span>Сетап</span></span></a></td>
</tr></tbody></table></div></div></div>';
}elseif($tours['konec']==2){
echo '</div><div class="clrb" style="margin-bottom:3px;margin-top:3px;"></div></div>
<div class="bot" style="margin-bottom:3px;margin-top:3px;"><div class="simple-but border" ">
<span><span>';
if($tours['win']==0){echo'Вы сыграли в ничью';}elseif($tours['win']==$mc['id']){echo'Вы победили!';}else{echo'Вы потерпели поражение';}
echo'</span></span></div></div>';
}elseif($tanks_code['wartour']==$tours['id'] && $in_tours['konec']==0){
echo'<table><tbody><tr><td class="w50"><a class="simple-but border" href="/myclan?battle&del" style="margin-bottom:3px;margin-top:3px;">
<span><span>Покинуть высадку</span></span></a></td>
<td class="w50"><a class="simple-but border" href="/myclan?battle&vis='.$tours['id'].'" style="margin-bottom:3px;margin-top:3px;">
<span><span>Сетап</span></span></a></td>
</tr></tbody></table></div></div></div>';
}
}
echo'<a class="simple-but gray" href="/myclan"><span><span>Назад</span></span></a></div>';
include_once'foots.php';exit;
?>