<?

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';

only_reg();
$set['title']='Фотоальбомы';

include_once '../sys/inc/thead.php';
title();
err();
//aut();
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `photo_album`"),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";
$q=mysql_query("SELECT * FROM `photo_album` ORDER BY id DESC LIMIT $start, $set[p_str]");
if (mysql_num_rows($q)==0) {
echo "   <tr>\n";
echo "  <td class='p_t'>\n";
echo "Нет Фотоальбомов\n";
echo "  </td>\n";
echo "   </tr>\n";
}
while ($photo = mysql_fetch_assoc($q))
{
echo "   <tr>\n";
echo "  <td class='p_t'>\n";
$ank=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '$photo[id_user]'"));
echo "<img src='name.gif' /> <a href='album.php?id=$photo[id]'>".output_text($photo['name'])."</a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM `photo_user` WHERE `id_album`='$photo[id]'"),0).")<br />";
echo "<img src='user.gif' /> ";
echo online($ank['id'])." <a href='/info.php?id=$ank[id]' title='Анкета \"$ank[nick]\"'><b>$ank[nick]</a><br/>\n";
if($photo['opis']!=0)echo "<img src='opis.gif' /> ".output_text($photo['opis'])."<br />";
echo "<img src='time.png' /> ".vremja($photo['time']);
echo "  </td>\n";
echo "  </tr>\n";
}
echo "</table>\n";
if ($k_page>1)str("?",$k_page,$page); // Вывод страниц
echo "<div class='foot'>\n";
echo "<img src='add.png' /> <a href='albumadd.php'>Добавить альбом</a><br />\n";
if($user['level']>0)echo "<img src='set.png' /> <a href='admin.php'>Админка</a><br />\n";
echo "</div>\n";
include_once '../sys/inc/tfoot.php';
?>