Размер файла: 1.67Kb
<?php
require_once '../core/system.php';
$header = 'Дуэль';
require_once '../core/head.php';
$t=time();
$tt=time()+30;
if(isset($_GET['agree'])){
$rqb = mysql_query("SELECT * FROM `duel` WHERE `id` = '".intval($_GET['id'])."'");
$zayvnb = mysql_num_rows($rqb);
$zaydav = mysql_fetch_array($rqb);
$kso = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$zaydav[usr]'"));
if($zayvnb==0 or $zaydav['who']>0 or $zaydav['timer']<$t or $zaydav['status']>0){header('Location: /duel/'); $_SESSION['err'] ='Дуэль не состоялась'; exit;}
if($zaydav['min']>$user['level'] or $zaydav['max']<$user['level']){header('Location: /duel/'); $err='Не подходит уровень'; exit;}
if($kso['mesto']=='Бой'){header('Location: /duel/'); $err='Игрок уже в бою'; exit;}
if($user['level']<10){header('Location: /'); $err='Нужен 10 уровень'; exit;}
if($user['mesto']=='Бой'){header('Location: /'); $err='Вы находитесь в бою'; exit;}
$tt=time()+15;
mysql_query("UPDATE `duel` set `agree`='1', `who`='$user[id]',`timer`='$tt' WHERE `id` = '".intval($_GET['id'])."'");
header('Location: /');
}
if(isset($_GET['otm'])){
$reqb = mysql_query("SELECT * FROM `duel` WHERE `id` = '".intval($_GET['id'])."' and `usr` = '$user[id]'");
$zayavnpb = mysql_fetch_array($reqb);
$zayavnb = mysql_num_rows($reqb);
if($zayavnb==0 or $zayavnpb['who']>0){header('Location: /'); exit;}
if(!isset($err)){
mysql_query("DELETE FROM `duel` WHERE `id` = '".intval($_GET['id'])."' and `usr` = '$user[id]'");
header('Location: /?'); $_SESSION['message'] = 'Заявка отменена';}else{$_SESSION['err'] = $err;}}
require_once '../core/foot.php';
?>