<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/adm_check.php';
include_once '../sys/inc/user.php';


if (isset($_GET['id']))$ank['id']=intval($_GET['id']);
else {header("Location: /index.php?".SID);exit;}


if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '$ank[id]' LIMIT 1"),0)==0){header("Location: /index.php?".SID);exit;}
$ank=get_user($ank['id']);

$set['title']='История нарушений/Банов '.$ank['nick'];
include_once '../sys/inc/thead.php';
title();

if (isset($_GET['unset']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `ban` WHERE `id_user` = '$ank[id]' AND `id` = '".intval($_GET['unset'])."'"),0) && user_access('user_ban_unset'))
{
$ban_info=mysql_fetch_assoc(mysql_query("SELECT * FROM `ban` WHERE `id_user` = '$ank[id]' AND `id` = '".intval($_GET['unset'])."'"));
$ank2=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '$ban_info[id_ban]' LIMIT 1"));

}
err();
echo "<div class='rekl'>\n";
echo "<img src='/style/back.gif' alt='' class='icon'/>\n";
echo "<a href=\"/prof.php?id=$ank[id]\">В анкету</a><br />\n";
echo "</div>\n";
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `ban` WHERE `id_user` = '$ank[id]'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
echo "<table class='post'>\n";

if ($k_post==0)
{
echo "<div class='tmn'>";
echo "Обитатель ни разу не был в тюрьме!\n";
echo "</div>\n";
}


$q=mysql_query("SELECT * FROM `ban` WHERE `id_user` = '$ank[id]' ORDER BY `time` DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_assoc($q))
{

$ank2=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_ban] LIMIT 1"));
echo "   <tr>\n";
echo '<tr><td class="icon14">';
avatar2($ank2['id']);

if($num==1){
echo "  <td class='menu_razd'>\n";
$num=0;
}else{
echo "  <td class='tf'>\n";
$num=1;}
echo "Посадил в тюрьму\n";
echo " ".online($ank2['id'])." <a href='/info.php?id=$ank2[id]'><span style=\"color:$ank2[ncolor]\">$ank2[nick]</span></a><br/>Арест до <font color='red'>".vremja($post['time'])."</font><br/>Причина:<b>\n";
echo esc(trim(br(bbcode(smiles(links(stripcslashes(htmlspecialchars($post['prich']))))))))."</b><br />\n";
if ($post['time']>$time && user_access('user_ban_unset'))
echo "<a href='?id=$ank[id]&amp;unset=$post[id]'>Снять бан</a><br />\n";
echo '</td></tr>';
}



echo "</table>\n";
if ($k_page>1)str('?id='.$ank['id'].'&amp;',$k_page,$page); // Вывод страниц

echo "<div class='rekl'>\n";
echo "<img src='/style/back.gif' alt='' class='icon'/>\n";
echo "<a href=\"/info.php?id=$ank[id]\">Назад на страничку</a><br />\n";
echo "</div>\n";



include_once '../sys/inc/tfoot.php';
?>