Файл: startok.php
Строк: 44
<?
define('PROTECTOR', 1);
include('files/path.php');
include($path.'files/db.php');
include($path.'files/auth.php');
include($path.'files/func.php');
going();
zasad();
ryd();
place_city();
place_zamok();
place_tower();
include($path.'files/core.php');
$time=time();
////////////////////////////////////////////////////////
if ($user_id==1){
if ($inaw==1){
include($path.'files/head.php');
include($path.'files/zag.php');
echo'У вас бой на арене!';
include($path.'files/down.php');exit;
}
///////////////
$id=intval($_GET['id']);
if($udata[activ]==on){
echo'Вы прошли обучение.';
include($path.'files/down.php');
exit;
}
if($udata[lvl]>0){
echo'Вы прошли обучение.';
include($path.'files/down.php');
exit;
}
if(empty($_GET[k])){
/////////////////////////////////////////////////////
////////////////////////
$req = mysql_query("SELECT * FROM `mesto` WHERE `usr` = '$log' LIMIT 1");
////////////////////////////
$mestouser = mysql_fetch_assoc($req);
$req = mysql_query("SELECT * FROM `mob1` WHERE `city` = '$udata[city]' and `id`='$id' and `x`='$mestouser[x]' and `y`='$mestouser[y]' LIMIT 1");
////////////////////////////
if (mysql_num_rows($req)==0){
$textl='Битва';
include($path.'files/head.php');
include($path.'files/zag.php');
echo"Такого монстра не существует.";include($path.'files/down.php');exit;}
/////////////////////////////
$mob = mysql_fetch_assoc($req);
if($mob['status']=='battle' or $mob['status']=='off'){
header ('Location: startbatt.php?');exit;
}
mysql_query("UPDATE `mob1` SET `status` = 'battle',`oponent`='$log' WHERE `city` = '$udata[city]' and `location`='$udata[location]' and `id`='$id' LIMIT 1");
mysql_query("INSERT INTO `tmp` SET `usr` = '$log',`mob` = '$id',`location`='$udata[location]',`city` = '$udata[city]',`ltime`='$time'");
$timer=time()+300;
del_log($lpl='battle');
mysql_query("INSERT INTO log SET usr='$log',text='$log против $mob[name]!Бой начался!',kto='system',place='battle',timer='$timer'");
header ('Location: startbattle.php?');exit;
}
else{
echo'Ошибка!';include($path.'files/down.php');exit;}
}else
{
echo 'Ошибка!Вы не авторизованы!<a href="index.php">Авторизуйтесь</a>';require_once 'files/end.php';exit;
}
?>