Размер файла: 2.1Kb
<?
require_once'../core/system.php';
echo only_reg();
echo ban();
echo blok();
$header='Задания';
require_once'../core/head.php';
if($user['level']<1){
header('location: /');
$_SESSION['err'] = 'Доступно только с 1 уровня'; exit;}
$req = mysql_query("SELECT * FROM `task_n` WHERE `usr`='$user[id]'");
$avto = mysql_num_rows($req);
if($avto==0){
mysql_query("INSERT INTO `task_n` SET `usr` = '$user[id]'");
}
$req = mysql_query("SELECT * FROM `task` WHERE `id`='".intval($_GET['id'])."' and `usr`='$user[id]' and `status`!='1'");
$task = mysql_fetch_array($req);
$avto = mysql_num_rows($req);
if($avto==0){
header('location: /task/normal');
$_SESSION['err'] = 'Ошибка'; exit;}
$req = mysql_query("SELECT * FROM `task` WHERE `usr` = '$user[id]' and `status`='2'");
$avto = mysql_num_rows($req);
if($avto>0){
mysql_query("UPDATE `task` set `status`='0' WHERE `usr` = '".$user['id']."' and `status`='2'");
}
$reqn = mysql_query("SELECT * FROM `task` WHERE `id`='".intval($_GET['id'])."'");
$taskn = mysql_fetch_array($reqn);
$reqnn = mysql_query("SELECT * FROM `task_n` WHERE `usr`='$user[id]'");
$tasknn = mysql_fetch_array($reqnn);
if($taskn['task']==4 and $user['level']<10){header('location: /task/normal'); $_SESSION['err'] = 'Ошибка'; exit;}
if($taskn['task']==5 and $user['level']<7){header('location: /task/normal'); $_SESSION['err'] = 'Ошибка'; exit;}
if($taskn['task']==7 and $user['level']<7){header('location: /task/normal'); $_SESSION['err'] = 'Ошибка'; exit;}
if($taskn['task']==8 and $user['level']<10){header('location: /task/normal'); $_SESSION['err'] = 'Ошибка'; exit;}
if($tasknn['task'.$taskn['task'].'']==1){header('location: /task/normal'); $_SESSION['err'] = 'Задание уже выполнено!'; exit;}
if($taskn['mod']==0){header('location: /');}
if($taskn['mod']==1){header('location: /task/fight/'.$taskn['eng'].'');}
mysql_query("UPDATE `task` set `status` = '2' where `usr` = '".$user['id']."' and `id`='".intval($_GET['id'])."'");
if($taskn['task']==10 and $tasknn['task3']==1){header('location: /capture/');exit;}
require_once'../core/foot.php';
?>