<?
$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 "   <tr>\n";
echo "  <td class='dop_menu'>\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']);
if($num==1){
echo '<tr><td class="pa">';
$num=0;
}else{
echo '<tr><td class="pa">';
$num=1;}
$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='Нет фото' align='left' style='margin-right:3px' width='48' height='48' alt='' />";
}
else
{
echo "<img src='/foto/foto128/$foto[id].$foto[ras]' alt='Фото_$foto[id]' align='left' style='margin-right:3px' width='48' height='48' alt='' />";
}

echo "".online($ank['id'])." <a href='/id$ank[id]'><span style=\"color:$ank[ncolor]\"><b>".GradientText("$ank[nick]", "$ank[ncolor]", "$ank[ncolor2]")."</b></span></a><br />\n";

echo "<img src='/icons/full-time.png' alt='' /> ".vremja($post['time_create'])." <br /><img src='/icons/pencil.png' alt='' /> ".vremja($post['time'])."<br />\n";

echo "<img src='/style/ico/photo.gif' alt='' /> <a href='/foto/$ank[id]/$post[id]/'><b><font color='blue'>&rarr;</font> $post[name]</b></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 "  </td>\n";
echo "   </tr>\n";

}
echo "</table>\n";
echo '<div class="dop_menu">&rarr; <a href="/foto/'.$ank[id].'/">Мои  ФотоАльбомы</a></div>';


if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
include_once '../sys/inc/tfoot.php';
exit;
?>