<?
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';
$ID = intval($_GET['id']);
if (isset($_GET['id']) && $_GET['id']!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '".intval($_GET['id'])."'"),0)!=0){	
$ank = get_user($ID);
$set['title']='Сообщества '.text($ank['nick']).''; // заголовок страницы
include_once '../sys/inc/thead.php';
title();
aut();

$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_user` WHERE `id_user` = '$ank[id]'"),0);
if ($k_post == 0)
{
	echo '<div class="mess">';
	echo 'Нет сообществ';
	echo '</div>';
}
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `comm_user` WHERE `id_user` = '$ank[id]' ORDER BY `level` DESC LIMIT $start, $set[p_str]");
while($comm = mysql_fetch_assoc($q)){
if ($num==0){
		echo '<div class="nav1">';
		$num=1;
	}elseif ($num==1){
		echo '<div class="nav2">';
		$num=0;
	}
	$status = intval($comm['level']);
	$idc = intval($comm['id_comm']);
	echo avatar_comm($idc); echo comm_name($idc);
	echo ' ';
	echo comm_user_group($status);
	echo'</div>';
}
if ($k_page>1)str("?",$k_page,$page);
echo "<div class='foot'><img src='/style/icons/str2.gif' alt=''/> <a href='/id$ank[id]'>Назад</a></div>";
	
}else{
	header("Location: /");
}
include_once '../sys/inc/tfoot.php';
?>