<?
$set['title']='Фотоальбомы'; // заголовок страницы
include_once '../sys/inc/thead.php';
title();
err();

if (isset($user))
{
echo "<div class=\"linegreen1\">\n";
echo "<a href='/foto/rating.php'>Фоторейтинг</a><br />\n";
echo "</div>\n";
}

$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 "   <tr>\n";
echo "  <td class='komm'>\n";
echo "Нет фотоальбомов\n";
echo "  </td>\n";
echo "   </tr>\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']);
echo "   <tr>\n";
echo "<div class='fotoname'>\n";
echo "<a href='/foto/$ank[id]/$post[id]/'><span style=\"color:$ank[mcolor]\">$post[name]</span></a> ".mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_gallery` = '$post[id]'"),0)." \n";
echo "<font color='#8b8a87'>(".vremja($post['time_create']).")</font></div>\n";
$foto = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id_gallery` = '$post[id]'  ORDER BY RAND()"));
if ($foto==null){
echo "<img src='/foto/foto48/0.png' alt='Нет фото' /><br/>";
}
else
{
echo "<img src='/foto/foto48/$foto[id].$foto[ras]' alt='Фото_$foto[id]' /><br/>";
}
echo "Автор:\n";
echo " ".online($ank['id'])." <a href='/info.php?id=$ank[id]'><span style=\"color:$ank[ncolor]\">$ank[nick]</span></a>\n";

echo "  </td>\n";
echo "  </tr>\n";

}
echo "</table>\n";
echo "<div class='linechat'></div>\n";
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц

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