<?
if (!isset($user) && !isset($_GET['id_user'])){header("Location: /foto/?".SID);exit;}
if (isset($user))$ank['id']=$user['id'];
if (isset($_GET['id_user']))$ank['id']=intval($_GET['id_user']);
$ank=get_user($ank['id']);
if (!$ank){header("Location: /foto/?".SID);exit;}

$set['title']=$ank['nick'].' - Фотоальбомы'; // заголовок страницы

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

include 'inc/gallery_act.php';
err();

echo "<div class='aut'>";
echo "<img src='/style/back.gif' alt='' class='icon'/>\n";
echo "<a href='/info.php?id=$ank[id]'>Страничка ($ank[nick])</a><br />\n";
echo "</div>\n";

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

$q=mysql_query("SELECT * FROM `gallery` WHERE `id_user` = '$ank[id]' ORDER BY `time` DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_assoc($q))
{
//echo "   <tr>\n";


echo '<tr><td class="icon14">';

$foto = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id_gallery` = '$post[id]' ORDER BY RAND()"));
if ($foto==null){
echo "<a href='/foto/$ank[id]/$post[id]/'><img src='/foto/foto48/0.png' alt='Нет фото' /></a>";
}
else
{
echo "<a href='/foto/$ank[id]/$post[id]/'><img src='/foto/foto128/$foto[id].$foto[ras]' alt='Фото_$foto[id]' width='60' height='50' /></a>";
}
echo "<br/><font color='red'>".mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_gallery` = '$post[id]'"),0)."</font> фото\n";
if($num==1){
echo '</td><td class="menu_razd">';
$num=0;
}else{
echo '</td><td class="p_t">';
$num=1;}
echo "Название: $post[name]<br/>\n";

if ($post['opis']==null)
echo "Без описания\n";
else 
echo "Описание:<b>\n";
echo esc(trim(br(bbcode(smiles(links(stripcslashes(htmlspecialchars($post['opis']))))))))."</b><br />\n";
echo 'Обновлён: '.vremja($post['time']).'<br/>';
echo "Создан: ".vremja($post['time_create']);
echo '</td></tr>';
}
echo "</table>\n";




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

echo "<div class='menu_razd'>";
echo "<img src='/style/icons/foto16.gif' alt='' class='icon'/>\n";
$xfoto = mysql_num_rows(mysql_query("SELECT `id` FROM `gallerea` WHERE `id_user` = '$ank[id]'"));
echo "<a href='/xxxfoto/$ank[id]/'><font color='black'>Эро-Альбомы</font></a> <font color='red'>($xfoto)</font><br/>";
echo "</div>\n";
include 'inc/gallery_form.php';
echo "<div class='aut'>";
echo "<img src='/style/back.gif' alt='' class='icon'/>\n";
echo "<a href='/prof.php?id=$ank[id]'>Анкета ($ank[nick])</a><br />\n";
echo "</div>\n";

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