Файл: foto/inc/user_gallery.php
Строк: 31
<?
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();
aut();
$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'];
include 'inc/gallery_form.php';
if ($k_post==0)
{
echo "<div class='msg'>n";
echo "Нет фотоальбомовn";
echo "</div>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 "<div class='forum'><a href='/foto/$ank[id]/$post[id]/' style='display:block;'><table><td>";
$z = mysql_query("SELECT * FROM `gallery_foto` WHERE `id_gallery` = '$post[id]' ORDER BY `id` DESC LIMIT 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='Нет фото' width='50px' height='50px'/>";
}
else
{
while ($x = mysql_fetch_assoc($z))
{
echo "<img src='/foto/foto128/$x[id].$x[ras]' alt='Фото_$x[id]' style='height:50px;width:50px;margin:3px'/>";
}
}
echo "</td><td>".htmlspecialchars($post['name'])." (".mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_gallery` = '$post[id]'"),0)." фото)<br/>";
if ($post['opis']!=NULL)echo "".htmlspecialchars($post['opis'])."";
echo "</td></table></a></div>";
}
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
include_once '../sys/inc/tfoot.php';
exit;
?>