<?
include_once '../sys/core/start.php';
include_once '../sys/core/compress.php';
include_once '../sys/core/sess.php';
include_once '../sys/core/home.php';
include_once '../sys/core/db_connect.php';
include_once '../sys/core/ipua.php';
include_once '../sys/core/fnc.php';
include_once '../sys/core/user.php';
include_once '../sys/inc/fnc_game.php';
include_once '../sys/inc/thead.php';
include_once '../sys/inc/uhead.php';
only_reg();
if ($user['acces']>0)
{
if(isset($_GET['id']) && intval($_GET['id'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '".intval($_GET['id'])."'"),0)!=0)
{
$banned_user=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='".intval($_GET['id'])."'"));
# снятие бана
if (isset($_GET['unset']) && $user['acces']>0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `ban` WHERE `id_user` = '$banned_user[id]' AND `id` = '".intval($_GET['unset'])."'"),0))
{
$ban_info=mysql_fetch_assoc(mysql_query("SELECT * FROM `ban` WHERE `id_user` = '$banned_user[id]' AND `id` = '".intval($_GET['unset'])."'"));
$in_ban=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '$ban_info[id_ban]' LIMIT 1"));
if ($user['acces']>$in_ban['acces'] && $user['id']==$in_ban['id'])
{
mysql_query("UPDATE `ban` SET `time` = '$time' WHERE `id` = '".intval($_GET['unset'])."' LIMIT 1");
$_SESSION['unset_ban']=1;
header("Location: /01019147adm/apban.php?id=".$banned_user['id']."");
}
else
{
$_SESSION['no_acces']=1;
header("Location: /01019147adm/apban.php?id=".$banned_user['id']."");
}
}
elseif(isset($_GET['banned']))
{
if (isset($_POST['ban_pr']) && isset($_POST['time']) && isset($_POST['vremja']) && $user['acces']>0 && $user['acces']>$banned_user['acces'])
{
$timeban=$time;
if ($_POST['vremja']=='min')$timeban+=intval($_POST['time'])*60;
if ($_POST['vremja']=='chas')$timeban+=intval($_POST['time'])*60*60;
if ($_POST['vremja']=='sut')$timeban+=intval($_POST['time'])*60*60*24;
if ($_POST['vremja']=='mes')$timeban+=intval($_POST['time'])*60*60*24*30;
if ($timeban<$time)$err[]='Ошибка времени бана';
$prich=$_POST['ban_pr'];
if (strlen2($prich)>1024){$err[]='Сообщение слишком длинное';}
if (strlen2($prich)<10){$err[]='Необходимо подробнее указать причину';}
$prich=my_esc($prich);
if (!isset($err)){
mysql_query("INSERT INTO `ban` (`id_user`, `id_ban`, `prich`, `time`) VALUES ('$banned_user[id]', '$user[id]', '$prich', '$timeban')");
$_SESSION['ok_ban']=1;
header("Location: /01019147adm/apban.php?id=".$banned_user['id']."");
}
}
err();
echo "<form method='post' action='''>";
echo "<table class='wdt msg-table'>";
echo "<tr><td align='left' style='vertical-align: top; width: 10%'><img src='/style/img/images/face-mex.png'></td>";
echo "<td align='left' style='vertical-align: top'>Создание бана. Выбор вестника и времени.</td></tr></table></td></tr></table>";
echo "<table class='wdt brown-header'><tr><td align='left'>От кого:</td></tr></table>";
echo "<table class='wdt gray-table'>";
echo "<tr><td class='white' align='left' style='height:30px;'>";
echo "<select name='vremja'>
<option value='min'>Минуты</option>
<option value='chas'>Часы</option>
<option value='sut'>Сутки</option>
<option value='mes'>Месяцы</option>
</select>";
echo "<td class='white' align='left' style='height:40px;'>";
echo "<input name='time' value='50' type='text'></td></tr></table>";
echo "<table class='wdt brown-header'><tr><td align='left'>Описание:</td></tr></table>";
echo "<table class='wdt green-table'>";
echo "<tr><td><table class='wdt'>";
echo "<tr><td align='center'><textarea class='wdt' name='ban_pr' style='margin: 0px; padding: 0px'></textarea></td></tr>";
echo "<tr><td style='padding-top: 5px;'><input class='yes-btn' name='save' type='submit' value='Создать'/></td></tr></table></form></td></tr></table>";
echo "<table class='wdt green-table'>";
echo "<tr><td align='center' style='padding: 0px; padding-left: 10px; padding-right: 10px; padding-bottom: 10px'>";
echo "<form action ='/01019147adm/news.php' method='get'><input type='submit' class='no-btn' value='Назад'/></form></td></tr></table>";
include_once '../sys/inc/tfoot.php';
}
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `ban` WHERE `id_user` = '$user[id]'"),0);
$k_page=k_page($k_post,10);
$page=page($k_page);
$start=10*$page-10;
echo "<table class='wdt msg-table'>";
echo "<tr><td align='left' style='vertical-align: top; width: 10%'><img src='/style/img/images/face-mex.png'></td>";
echo "<td align='left' style='vertical-align: top'>История нарушений игрока: <b>$banned_user[nick]</b></td></tr></table></td></tr></table>";
echo "<table class='wdt brown-header'><tr><td align='left'>История:</td></tr></table>";
$q=mysql_query("SELECT * FROM `ban` WHERE `id_user` = '$banned_user[id]' ORDER BY `time` DESC LIMIT $start, 10");
while ($post = mysql_fetch_assoc($q))
{
$ank_one=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '".$post['id_ban']."'"));
echo "<table class='wdt gray-table'>";
echo "<tr><td colspan='2' width='60px' style='border-top: 1px solid #000;' class='white' align='left'>";
echo "<a href='/dev/info.php?id=".$post['id_ban']."' class='green'><b>$ank_one[nick]</b></a>: до ".vremja($post['time'])."";
echo "</br><b class='yellow'>Причина</b>: ".output_text($post['prich'])."";
if($post['time']>$time)
{
echo "</br><b class='yellow'>Статус</b>: <b class='red'>Активен</b></td></tr></table>";
}
else
{
echo "</br><b class='yellow'>Статус</b>: <b class='green'>Обнулен</b></td></tr></table>";
}
}
echo "<table class='wdt gray-table'>";
echo "<tr><td class='white td-cell' align='center' style='height:30px;'><form action='/dev/map.php' method='post'><input type='submit' class='no-btn' value='Назад'></form></td>";
echo "<td class='white td-cell' width='50%' align='center' style='height:30px;'><form action='/01019147adm/apban.php?id=".$banned_user['id']."&banned' method='post'><input type='submit' class='yes-btn' value='Забанить'></form></td></tr></table>";
include_once '../sys/inc/tfoot.php';
}
}
else
{
header("Location: /dev/garage.php");
}
?>