Файл: ar_bz.php
Строк: 109
<?
define('PROTECTOR', 1);
$textl='Боевая Зона';
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
include($path.'files/core.php');
$mobs9=mysql_query("SELECT * FROM `arena_usr` WHERE `usr`='".$udata['id']."'");
$rows9=mysql_num_rows($mobs9);
if($rows9==0)
{
header('location: arena.php');exit;
}
$bzu=mysql_fetch_array(mysql_query("SELECT * FROM `arena_usr` WHERE `usr`='".$udata['id']."'"));
$bz_sel=mysql_query("SELECT * FROM `arena` WHERE `id`='".$bzu['arr']."'");
$bz_num=mysql_num_rows($bz_sel);
if($bz_num==0)
{
header('location: arena.php');exit;
}
else
{
$bz=mysql_fetch_array($bz_sel);
}
if($bz['st']==1)
{
header('location: b_bz.php');exit;
}
if($bz['time']<=time() and $bz['usr']==$udata['id'])
{
$bz_us=mysql_query("SELECT * FROM `arena_usr` WHERE `arr`='".$bz['id']."' and `kom`='0' and `tip`='usr' ORDER BY `stats` DESC");
while($uz=mysql_fetch_array($bz_us))
{
$bz_user=mysql_result(mysql_query("SELECT SUM(stats) FROM `arena_usr` WHERE `arr`='".$bz['id']."' and `kom`='1' and `tip`='usr'"),0);
$bz_user2=mysql_result(mysql_query("SELECT SUM(stats) FROM `arena_usr` WHERE `arr`='".$bz['id']."' and `kom`='2' and `tip`='usr'"),0);
if($bz_user>$bz_user2){$kom=2;}
elseif($bz_user<=$bz_user2){$kom=1;}
mysql_query("UPDATE `arena_usr` SET `kom`='".$kom."' WHERE `arr`='".$bz['id']."' and `usr`='".$uz['usr']."'");
}
mysql_query("UPDATE `arena` SET `st`='1' WHERE `id`='".$bz['id']."'");
header('location: ?');exit;
}
if(isset($_GET['rasp']))
{
if($bz['usr']==$udata['id'] and $bz['time']>time())
{
mysql_query("DELETE FROM `arena_usr` WHERE `arr`='".$bz['id']."'");
mysql_query("DELETE FROM `arena` WHERE `id`='".$bz['id']."'");
}
header('location: arena.php');exit;
}
if(isset($_GET['leave']))
{
if($bz['usr']!=$udata['id'] and $bz['time']>time())
{
mysql_query("DELETE FROM `arena_usr` WHERE `usr`='".$udata['id']."'");
}
header('location: arena.php');exit;
}
include($path.'files/head.php');
include($path.'files/zag.php');
echo '<table width=100%>
<tr>
<td width=35%>
<a href=game.php><div style="background: #882222; border-radius: 7px 0 0 7px" class="m p bts bbs brs bls" align=center>Главная</div></a>
</td><td>';
echo '<a href=?><div class="line bts brs bls bbs p m" style="border-radius: 0 7px 7px 0">
<font color=#ffffff>Боевая Зона: #'.$bz['id'].'</font>
</div></a></td></tr></table>';
echo '<div class="bat bts brs bls bbs p">';
echo '<div class="v5 v8 p"><div align=left>
<img src=img/main/i25.png> Лидер зоны: ';
$users=mysql_query("SELECT * FROM `users` WHERE `id`='".$bz['usr']."'");
$us=mysql_fetch_array($users);
echo '<img src=img/main/c'.$us['klass'].'.png> <img src=img/main/r'.$us['rasa'].'.png>
<a href=info.php?id='.$us['id'].'>'.$us['usr'].'</a> <img src=img/main/p10.png>'.$us['lvl'].'<br>';
echo '<img src=img/main/i25.png> До боя: <img src=img/main/e12.png> ';
$time=$bz['time']-time();
$h=floor($time/3600);
$m=floor(($time-($h*3600))/60);
$s=$time-($h*3600)-($m*60);
$tim=$h.':'.$m.':'.$s;
if($bz['time']<time()){$tim='Ожидание лидера';}
echo '<font color=#0099ff><i>'.$tim.'</i></font><br>';
echo '<img src=img/main/i25.png> Участники: ';
$num=mysql_num_rows(mysql_query("SELECT * FROM `arena_usr` WHERE `arr`='".$bz['id']."' and `tip`='usr'"));
echo '<font color=#ffff00><b>'.$num.'</b></font><br>';
echo '<font color=#ff0000><small>минимум 4 участника</small></font>';
if($bz['usr']==$udata['id'])
{
echo '<a href=?rasp><div style="background: #226622; padding: 3px; margin: 4px; border-radius: 6px" align=center><font color=#ffff00><b>Распустить</b></font></div></a>
';
}
else
{
echo '<a href=?leave><div style="background: #226622; padding: 3px; margin: 4px; border-radius: 6px" align=center><font color=#ffff00><b>Покинуть</b></font></div></a>
';
}
echo'</div></div>';
echo '</div></div>';
echo '<div class="v8"><div class="line m bts brs bls b p v12">Участники</div>
<div class="bat bts brs bls bbs p">';
echo '<table width=100%>';
$bz_user=mysql_query("SELECT * FROM `arena_usr` WHERE `arr`='".$bz['id']."' and `tip`='usr' ORDER BY `stats` DESC");
while($b_usz=mysql_fetch_array($bz_user))
{
$b_users=mysql_query("SELECT * FROM `users` WHERE `id`='".$b_usz['usr']."'");
$b_us=mysql_fetch_array($b_users);
echo '<tr><td width=70 align=center>';
if($b_us['ava']==0)
{
echo'<img src=img/pers/'.$b_us['klass'].''.$b_us['pol'].'.png width=64px><br>';
}
else
{
echo'<img src=img/pers/ava/'.$b_us['ava'].'.png width=64px><br>';
}
echo '</td>';
echo '<td align=center>';
echo '<img src=img/main/c'.$b_us['klass'].'.png> <img src=img/main/r'.$b_us['rasa'].'.png>
<a href=info.php?id='.$b_us['id'].'>'.$b_us['usr'].'</a><br><img src=img/main/e28.png> Статы: '.$b_us['stats'].'';
echo '</td>';
echo '</td></tr>';
}
echo'</table>';
echo '</div></div>';
include($path.'files/down.php');
?>