<?
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '".intval($_GET['id'])."'"),0)!=0)
{
$ank=get_user(intval($_GET['id']));

$set['title'] = 'Сообщества '.$ank['nick']; // Заголовок страницы
include_once '../sys/inc/thead.php';
title();
aut();
echo "<div class='foot'>\n";echo "<img src='/style/icons/str2.gif' alt='*'> <a href='/info.php?id=$ank[id]'>$ank[nick]</a> | <b>Сообщества</b><br />\n";echo "</div>\n";
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `comm_users` 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='main'>\n";
echo "Нет сообществ\n";
echo "</div>\n";
}
$q=mysql_query("SELECT * FROM `comm_users` WHERE `id_user` = '$ank[id]' ORDER BY `last_time` DESC LIMIT $start, $set[p_str]");

while($post=mysql_fetch_array($q))
{
$comm=mysql_query("SELECT * FROM `comm` WHERE `id` = '$post[id_comm]'");
$comm=mysql_fetch_array($comm);
$aname=NULL;
if($post['access']=='creator')$aname='создатель';
elseif($post['access']=='adm')$aname='администратор';
elseif($post['access']=='mod')$aname='модератор';
echo "<div class='main'>\n";
echo "<img src='/comm/img/comm_".($comm['read_rule']==1?"open":"closed").".png' /> \n";
echo "<a href='?act=comm&id=$comm[id]'>".htmlspecialchars($comm['name'])."</a>\n";
if($aname!=NULL)echo " ($aname)";
echo "</div>\n";
echo "</tr>\n";
}
echo "</table>\n";
if ($k_page>1)str("?act=user&id=$ank[id]&",$k_page,$page); // Вывод страниц

echo "<div class='foot'>\n";echo "<img src='/style/icons/str2.gif' alt='*'> <a href='/info.php?id=$ank[id]'>$ank[nick]</a> | <b>Сообщества</b><br />\n";echo "</div>\n";
}
else{header("Location:/comm");exit;}
?>