Файл: mylaf.ru/foto/inc/user_gallery.php
Строк: 47
<?
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;}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `id_user` = '$ank[id]' AND `name` = 'Личные фото'"),0)==0)
{
mysql_query("INSERT INTO `gallery` (`id_user`, `name`, `my`) values('$ank[id]', 'Личные фото', '1')");
}
$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]' AND `my` = '0'"),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';
$my_alb=mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery` WHERE `id_user` = '$ank[id]' AND `my` = '1' LIMIT 1"));
if (isset($user) && $user['id']==$ank['id'] || user_access('foto_alb_del')){
if (isset($user) && $user['id']==$ank['id'])
echo "<a href='/foto/$ank[id]/$my_alb[id]/?act=upload'><div class='forum'><img src='/style/icons/pht2.png'> Добавить личное фото</div></a>n";
}
echo "<a href='/foto/$ank[id]/$my_alb[id]/'><div class='forum'>$my_alb[name] (".mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_gallery` = '$my_alb[id]'"),0)." фото)<br/>";
$zz = mysql_query("SELECT * FROM `gallery_foto` WHERE `id_gallery` = '$my_alb[id]' ORDER BY `id` DESC LIMIT 1");
$fotos = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id_gallery` = '$my_alb[id]' ORDER BY id DESC"));
if ($fotos==null){
echo "<img src='/foto/foto48/0.png' alt='Нет фото' width='200px' height='200px'/></div></a>";
}
else
{
while ($xx = mysql_fetch_assoc($zz))
{
echo "<img src='/foto/foto640/$xx[id].$xx[ras]' alt='Фото_$xx[id]' style='width:200px;height:200;margin:3px'/></div></a>";
}
}
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]' AND `my` = '0' ORDER BY `time` DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_assoc($q))
{
echo "<a href='/foto/$ank[id]/$post[id]/'><div class='forum'>$post[name] (".mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_gallery` = '$post[id]'"),0)." фото)<br/>";
$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='200px' height='200px'/></div></a>";
}
else
{
while ($x = mysql_fetch_assoc($z))
{
echo "<img src='/foto/foto640/$x[id].$x[ras]' alt='Фото_$x[id]' style='height:200px;width:200px;margin:3px'/></div></a>";
}
}
}
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
include_once '../sys/inc/tfoot.php';
exit;
?>