Файл: www-1/animal.php
Строк: 20
<?php
define('cms', 1);
require_once 'core.php';
if ($user)
{
Error_Reporting(E_ALL & ~E_NOTICE);
$u = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".$user."'"));
echo '<div class="menu">Бой</div>';
echo '<div class="pt">';
switch ($_GET['a'])
{
default:
if ($u['hp'] > 0)
{
$last = time()-$u['fight_time'];
if ($last < $c['arena_time'])
{
echo 'Вам нужно набраться сил от предыдущего боя!';
}
else {
$is = mysql_result(mysql_query("SELECT count(*) FROM `fights` WHERE `y` = '".$user."' AND `end` = 0"),0);
if ($is == 1) header('Location: ./fight.php');
if (isset($_GET['id']))
{
$b = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '".abs(round($_GET['id']))."'"));
if ($b['id'] == 0) header('Location: ./index.php');
if ($b['level'] !== $u['level']) header('Location: ./index.php');
$uid = rand(100000,2000000000);
mysql_query("INSERT INTO `fights` SET
`uid` = '".$uid."',
`b` = '".$b['id']."',
`y` = '".$user."',
`armor` = '".$b['armor']."',
`damage` = '".$b['damage']."',
`hp_b` = '".$b['hp']."';");
mysql_query("UPDATE `users` SET `busy` = 1 WHERE `id` = '$user'");
header('Location: ./fight.php');
}
}
} else echo 'У вас нет сил справиться с противником. Пополните здоровье.';
break;
}
echo '</div>';
}
else
{
header('Location: ./index.php');
}
include './include/foot.php';
?>