<?
include '../config.php';
include '../func.php';
head();
aut();
ban();
if($error){ echo $error;
}else{
/////////////////////////////
mysql_query("UPDATE `profile` SET `online` = 'photo' WHERE `id` = '".$id_session."'");
echo "<div class=\"head\"><b>Фотоальбомы</b></div><div class=\"main\">";  

$id = num($_GET['user']);
$user = mysql_fetch_assoc(mysql_query("SELECT * FROM `profile` WHERE `id` = '".$id."'"));

if ( empty($user['id']) ) {
    
    echo link2 . 'Данный пользователь не найден' . div;
    pod_navig();
    foot();
    exit();
    
}

$all = mysql_result(mysql_query("SELECT count(*) FROM `photo_album` WHERE `user` = '".$id."'"), 0);
if($all==0)
echo 'Альбомы еще не созданы';
else
$query = @mysql_query("SELECT * FROM `photo_album` WHERE `user` = '".$id."'");
while($result = @mysql_fetch_array($query))
{
    $all_photos = mysql_result(mysql_query("SELECT count(*) FROM `photo_photos` WHERE `album` = '".$result['id']."'"), 0);
echo "<div class=\"main\">";
$photo_1 = mysql_fetch_assoc(mysql_query("SELECT * FROM `profile` WHERE `id` = '".$result['user']."'"));
if(isset($photo_1['osnov_photo']))
$photo_2 = mysql_fetch_assoc(mysql_query("SELECT * FROM `photo_photos` WHERE `id` = '".$photo_1['osnov_photo']."'"));

if(isset($photo_2['file']))
echo "<b>Основное фото:</b><br/><img src=\"../pict.php?file=photo/files/$photo_2[file]\" alt=\".\" /><br/>";
echo "<b>Альбом:</b> <a href=\"photos.php?id=".$result['id']."\">".$result['name']."</a> [".$all_photos."] <br/>";




echo "<small>Автор: ";
echo "".user($result['user'])."<br/></small>";
if($result['date'])
echo "<small>".strftime("Создан %d.%m.%y",$result['date'])."</small><br/>";
if($result['obnov'])
echo "<small>".strftime("Изменен %d.%m.%y",$result['obnov'])."</small><br/>";

if($result['prosm'])
echo "<small>Просмотров: ".$result['prosm']."</small><br/>";
echo '</div>';
}

}
pod_navig();
foot();
?>
