<?
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `comm` WHERE `id` = '".intval($_GET['id'])."'"),0)!=0)
{
$comm=mysql_query("SELECT * FROM `comm` WHERE `id` = '".intval($_GET['id'])."'");
$comm=mysql_fetch_array($comm);
$set['title'] = 'Сообщество - '.htmlspecialchars($comm['name']).' - Нарушения'; // Заголовок страницы
include_once '../sys/inc/thead.php';
title();
aut();



$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_ban` WHERE `id_comm` = '".intval($_GET['id'])."'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];


if ($k_post==0)
{
echo "<div class='main'>Спосок пуст.</div>\n";
}
$q=mysql_query("SELECT * FROM `comm_ban` WHERE `id_comm` = '".intval($_GET['id'])."' ORDER BY `time` DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_assoc($q))
{
if ($num==0){echo "  <div class='nav1'>\n";$num=1;}elseif ($num==1){echo "  <div class='nav2'>\n";$num=0;}

$ban_adm=get_user($post['id_banned']);
if ($post['type']==1)$type='Бан';
elseif ($post['type']==2)$type='Предупреждение';
elseif ($post['type']==3)$type='Блок';

echo "Тип: <span style='color: darkgreen;'>$type</span><br />\n";

echo "Заблокировано: ";
echo " <a href='/info.php?id=$ban_adm[id]'>$ban_adm[nick]</a>".online($ban_adm['id']).group($ban_adm['id'])." <br />\n";
if ($post['type']==1)echo "Забанил до: ".vremja($post['time'])."</span><br />\n";
elseif ($post['type']==3)echo "Забанил: <span style='color: darkgreen;'>Навсегда!</span><br />\n";
echo "Причина:\n";
echo " <span style='color: darkgreen;'>".output_text($post['prich'])."</span><br />\n";
if (user_access('comm')){

echo "<div align='right'><a href='?act=comm_ban&id=$comm[id]&delete=$post[id]'><img src='/comm/img/delete.png'></a></div>";

}

echo "</div>";
}


if (user_access('comm') && isset($_GET['delete'])){
$ban=mysql_query("DELETE FROM `comm_ban` WHERE `id` = '".intval($_GET['delete'])."'");
header("Location: /comm/?act=comm_ban&id=$comm[id]");



}

if (user_access('comm')){
echo "<div class='nav2'><a href='/adm_panel/comm_ban.php?id=$comm[id]'>Заблокировать &rarr;</a></div>";
}

echo "<div class='foot'><img src='/style/icons/str2.gif'> <a href='/comm/?act=comm&id=$comm[id]'>В сообщество</a></div>";

}
else{header("Location:/comm");exit;}

?>