<?php
$title = 'Дать бан';
include_once '../system/function.php';
include_once '../system/header.php';

if($user['level'] < 1){echo'<div class="podmenu">У вас недостаточно прав!</div>';
include_once '../system/footer.php';
exit();}
$id = abs(intval($_GET['id']));

$adban = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".$id."'"));
if($adban['id'] == 0 or $user['id'] == $id or $id == 1){
echo '<div
class="podmenu"><center><b>Ошибка!
</b></center></div>';
require_once ('../system/footer.php');
exit();
}
if(isset($_REQUEST['ok'])) {
$about = strong($_POST['about']);
$time_end = strong($_POST['time_end']);
if(empty($about) or mb_strlen($about) < 3){
echo'<div
class="podmenu"><center><b>Ошибка
ввода ,минимум 3 символа!</b></
center></div>';
require_once ('../system/
footer.php');
exit();
}
mysql_query("INSERT INTO
`ban_list` SET `about` = '".$about."',`time_end` = '".(time()+($time_end*(60*60)))."', `add_ban` = '".$user
['id']."', `kto` = '".$id."', `time_play` ='".time()."'");
$pdo->exec("INSERT INTO `nar` SET `why` = '".$about."', `who`= '".$user['id']."', `ho` = '".$id."', `time`='".time()."'");
header('Location: '.$HOME.'/user_'.$id.'');
exit();
}
$sql = mysql_fetch_assoc(mysql_query("SELECT * FROM `ban_list` WHERE `kto` = '".$id."'"));
if($sql == 0){
echo'<div class="podmenu">Вы
желаете дать бан '.nick($id).' ?</div>
<div class="podmenu"><form action="" method="POST">
*Причина:<br /><textarea name="about"></textarea><br/>
*Срок:<br/><select
name="time_end"><option value="3">3
часа</option><option value="24">Сутки</option><option value="72">3 дня</option><option value="168">Неделя</option><option value="720">Месяц</option><option value="8640">Год</option></select><br/> <input type="submit" name="ok" value="Банить" />
</form></div>';
}else{
echo'<div
class="podmenu"><center><b>Этот
пользователь уже забанен!!</b></center></div>';}
include_once '../system/footer.php';
?>
