<?
/* Бан пользователя */ 
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ban` WHERE `razdel` = 'foto' AND `id_user` = '$user[id]' AND (`time` > '$time' OR `view` = '0' OR `navsegda` = '1')"), 0)!=0)
{
header('Location: /ban.php?'.SID);exit;
}
$set['title']='Фотоальбомы'; // заголовок страницы

include_once '../sys/inc/thead.php';
title();

err();
aut();




$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery`"),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='mess'>\n";
echo "Нет фотоальбомов\n";
echo "</div\n";
}

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

/*-----------зебра-----------*/
if ($num==0)
{echo '<div class="nav1">';
$num=1;
}elseif ($num==1)
{echo '<div class="nav2">';
$num=0;}
/*---------------------------*/

$foto = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id_gallery` = '$post[id]' ORDER BY RAND()"));

echo "<img src='/style/themes/$set[set_them]/loads/14/dir.png' alt='*' /> ";

echo "<a href='/foto/$ank[id]/$post[id]/'>$post[name]</a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_gallery` = '$post[id]'"),0)." фото)<br />\n";

if ($post['opis']==null)
echo "Без описания<br />\n";
else 
echo esc(trim(br(bbcode(smiles(links(stripcslashes(htmlspecialchars($post['opis']))))))))."<br />\n";

echo "Создан: ".vremja($post['time_create'])."<br />\n";

echo "Автор: ";
echo group($ank['id'])." <a href='/info.php?id=$ank[id]'>$ank[nick]</a>  ".medal($ank['id'])."  ".online($ank['id'])."<br />\n";

echo "</div>\n";
}
echo "</table>\n";




if ($k_page>1)str('?',$k_page,$page); // Вывод страниц



if (isset($user))
{
echo "<div class=\"foot\">\n";
echo "<img src='/style/icons/str.gif' alt='*'> <a href='/foto/$user[id]/'>Мои альбомы</a><br />\n";
echo "</div>\n";
}

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