View file sdark.mobi/duel/application.php

File size: 1.51Kb
<?
include_once '../core/system.php';
echo only_reg();
echo ban();
echo blok();
$header = 'Заявка';
include_once '../core/head.php';
$req = mysql_query("SELECT * from `duel` where `usr` = '$user[id]' and `status`='0'");
$avto= mysql_num_rows($req);
if($avto>0){
header("Location: /duel/");
$_SESSION['err'] = 'Заявка на дуэль уже создана!';
exit();
}
$req = mysql_query("SELECT * from `duel` where `who` = '$user[id]' and `status`='0'");
$avto= mysql_num_rows($req);
if($avto>0){
header("Location: /duel/");
$_SESSION['err'] = 'Заявка на дуэль уже создана!';
exit();
}

if(empty($_POST['ot']) && empty($_POST['do'])){
echo "<div class='d-grey'><form action='?' method='POST'>";

echo 'Минимальный уровень:</br>
<input class="text-area" type="text" value="10" name="ot" />';
echo 'Максимальный уровень:</br>
<input class="text-area" type="text" value="150" name="do" />';
 
echo'<div class="empty"></div>
<input class="inpc-ar form-submit" type="submit" value="Отправить" /></form></div>';
}else{
$ot = check($_POST['ot']);
$do = check($_POST['do']);
if($user['plem']=='ogn'){$race='0';}
if($user['plem']=='mol'){$race='1';}
if($ot<10 or $ot>$do or $do>150){
header("Location: ?");
$_SESSION['err'] = 'Ошибка!';
exit();
}

$t=time()+300;
mysql_query("INSERT INTO `duel` SET `usr` = '$user[id]', `race`='$race', `min`='$ot', `max`='$do', `timer`='$t'");

header("Location: /duel/");
exit();
}
echo"</div>";
include_once '../core/foot.php';
?>