<?php
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/user.php';

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

$set['title']='БАН';
include_once '../sys/inc/thead.php';

title();
aut();


$comm = mysql_fetch_array(mysql_query('SELECT * FROM `community_comm` WHERE `id` = '.$soo.' LIMIT 1'));

if(!isset($user)){
	echo '<div class="err">Доступ закрыт.</div>';
	}else if($soo==0 || $soo<0){
		echo '<div class="err">Иди нахуй! Хакер недоношеный!</div>';
		}else if($soo!=$comm['id']){
			echo '<div class="err">Сообщество не найдено.</div>';
			}else if(mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_ban` WHERE `id_user` = '$user[id]' AND `id_comm` = '$soo' AND `time` > '$time'"),0)==0){
				header('Location: comm.php?id='.$soo);
				}else{

$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_ban` WHERE `id_user` = '$user[id]' AND `id_comm` = '$soo'"),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">';

$q=mysql_query("SELECT * FROM `comm_ban` WHERE `id_user` = '$user[id]' AND `id_comm` = '$soo' ORDER BY `time` DESC LIMIT $start, $set[p_str]");
while($post = mysql_fetch_array($q)){
	$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_ban] LIMIT 1"));
	echo '<tr><td class="icon14"><img src="/style/themes/'.$set['set_them'].'/user/'.$ank['pol'].'.png" alt=""/></td><td class="p_t">'.$ank['nick'].' до '.vremja($post['time']).'<br/>';
	echo '</td></tr><tr><td class="p_m" colspan="2">'.output_text($post['prich']).'<br/></td></tr>';
	}

echo '</table>';

if($k_page>1){
	str("ban.php?id=$soo",$k_page,$page);
	}
	}

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