Файл: tankon.mobi/tanks/boys.php
Строк: 248
<?php
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
include_once '../sys/inc/thead.php';
title();aut();
echo '<link rel="stylesheet" href="style.css" type="text/css" />';
include_once 'function.php';
if(isset($_GET['ok'])){
if(isset($_GET['id'])){
$tournament = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_tournament` WHERE `id`='".intval($_GET['id'])."'"));
if ($tanks_code['tour']==0){
if ($tanks_code['tank']>0){
if ($tanks_code['leveltank']>=$tournament['leveln'] && $tanks_code['leveltank']<=$tournament['levelc']){
$ataka=$tanks_code['ataka']+$s1+($mc['vet']*10);
$bron=$tanks_code['bron']+$s2+($mc['vet']*10);
$toch=$tanks_code['toch']+$s3+($mc['vet']*10);
$proch=$tanks_code['proch']+$s4+($mc['vet']*10);
mysql_query("INSERT INTO `tanks_tournament_users` (`user`,`tanks`,`ataka`,`bron`,`toch`,`proch`,`twofuel`,`tour`) VALUES ('$tanks_code[id_u]','$tanks_code[tank]','$ataka','$bron','$toch','$proch','0','$tournament[id]')");
mysql_query("UPDATE `tanks` SET `tour`='".$tournament['id']."' WHERE `id_u`='".$user['id']."' ");
header ("Location: /tournament");
}else {err_game('Ваш уровень мал для участия');}
}else {err_game('Выберите танк для участия');}
}else {err_game('Можно участвовать только в одном турнире');}
}
}
if(isset($_GET['result'])){
if(isset($_GET['id'])){
$tour_win= mysql_query("SELECT * FROM `tanks_tournament_users` where `tour`='".intval($_GET['id'])."' ORDER BY win DESC LIMIT 5");
echo'<div class="trnt-block p5" style="margin-bottom:5px;"><div class="medium white bold cntr">ТОП-5</div></div>';
while($tour_wins = mysql_fetch_array($tour_win)) {
$win_good = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_tournament` WHERE `id`='".$tour_wins['tour']."'"));
$tankss_wins = mysql_fetch_array(mysql_query("SELECT * FROM `tanks` WHERE `id_u`='".$tour_wins['user']."'"));
$avatar_win = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_ava` WHERE `id`='".$tankss_wins['ava']."'"));
$tanksss_wins = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='".$tankss_wins['id']."'"));
echo'<div class="trnt-block p5" style="margin-bottom:5px;"><div class="mb0 inbl">
<div class="thumb fl"><a href="/profile?id='.$tanksss_wins['id'].'">
<img src="/images/avatar/'.$avatar_win['screen'].'" alt="" title=""></a>
<span class="mask2"> </span>
</div>';
echo'<div class="ml58 small white sh_b bold"><a href="/profile?id='.$tanksss_wins['id'].'">'.$tanksss_wins['nick'].'</a><br>Побед: <font color="#9ACD32">'.$tour_wins['win'].'</font><br>
Награда: <img src="tanks/images/icons/gold.png"> <font color="#DAA520">'.$win_good['zolota'].'</font>, <img src="tanks/images/icons/exp.png"> <font color="#DAA520">'.$win_good['rating'].'</font><br>';
echo '</div></div></div>
</div>';
}
echo'<a class="simple-but gray" href="/tournament"><span><span>Назад</span></span></a></div>';
exit;
}
}
$tour_you = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_tournament_users` WHERE `user`='".$tanks_code['id']."' AND `vkl`='0'"));
$in_tour_you = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_tournament` WHERE `id`='".$tour_you['tour']."' "));
if($in_tour_you['konec']==1){header ("Location: wartour?id=".$in_tour_you['id']."");}
$tour= mysql_query("SELECT * FROM `tanks_tournament` ORDER BY id DESC LIMIT 5");
while($tours = mysql_fetch_array($tour)) {
$you_tour = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_tournament_users` WHERE `user`='".$tanks_code['id']."'"));
$in_tour = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_tournament` WHERE `id`='".$you_tour['tour']."'"));
$in_tours = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_tournament` WHERE `id`='".$tours."'"));
if ($tanks_code['tour']==0 && $tanks_code['leveltank']>=$tours['leveln'] && $tanks_code['leveltank']<=$tours['levelc']){
echo '<div class="trnt-block" style="margin-bottom:3px">';
}
elseif($tanks_code['tour']==$tours['id'] && $in_tours['konec']==0){
echo '<div class="trnt-block" style="border:2px solid #104E8B;width:98%;margin-left:2px;margin-bottom:5px">';
}
elseif($tours['konec']==2 && $tanks_code['tour']==0){echo '<div class="trnt-block" style="margin-bottom:5px">';}
else{
echo '<div class="trnt-block" style="margin-bottom:5px">';
}
$time_tour=time_left($tours['nachalo']-time());
$kol_play = mysql_result(mysql_query("SELECT COUNT(*) FROM `tanks_tournament_users` WHERE `tour` = '".$tours['id']."'"), 0);
echo'
<div class="wrap1 p5">
<div class=" inbl">
<div class="thumb fl">
<img src="/tanks/images/tour/'.$tours['screen'].'"">
<span class="mask2"> </span>
</div>
<div class="ml58 small white sh_b bold">
<span class="green2">'.$tours['name'].' ';
if($tours['konec']==1){echo'началась</span>';}
elseif($tours['konec']==2){echo'кончилась</span>';}
elseif($tours['konec']==0){echo'с '.$tours['nachalo'].' по '.$tours['time_k'].'</span>';}
echo', игроков: '.$kol_play.'<br>Тип: <span class="gray1">'.$tours['type'].'</span>, уровень танка с '.$tours['leveln'].' по '.$tours['levelc'].'<br>
Приз: <img src="tanks/images/icons/gold.png"> '.$tours['zolota'].', <img src="tanks/images/icons/exp.png"> '.$tours['rating'].'';
echo'
</div></div></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>';if($tanks_code['tour']==0 && $tours['konec']==0 && $tanks_code['leveltank']>=$tours['leveln'] && $tanks_code['leveltank']<=$tours['levelc']){
echo '</div>
<div class="clrb" style="margin-bottom:3px;margin-top:3px;"></div>
</div>
<div class="bot" style="margin-bottom:3px;margin-top:3px;">
<a class="simple-but border" href="?ok&id='.$tours['id'].'">
<span>
<span>
За родину!!!
</span>
</span>
</a>
</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;">
<a class="simple-but border" href="?result&id='.$tours['id'].'">
<span>
<span>
Результаты боя
</span>
</span>
</a>
</div>';}
}
include_once 'foots.php';
?>