<?
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/downloadfile.php';
include_once '../sys/inc/user.php';

only_reg();



$v=mysql_fetch_assoc(mysql_query("SELECT * FROM `photo_user` WHERE `id` = '".intval($_GET['id'])."'"));
$photo=mysql_fetch_assoc(mysql_query("SELECT * FROM `photo_album` WHERE `id` = '".$v['id_album']."'"));
if(!$v)header("Location: index.php");
if($photo['id_user']!=$user['id'] && ($photo['pass']!=NULL || $photo['pass']!=0))header("Location: index.php");

if (is_file(H.'sys/photo/files/'.$v['id'].'.'.$v['ras']))
{
DownloadFile(H.'sys/photo/files/'.$v['id'].'.'.$v['ras'], 'foto_'.$if_foto.'.'.$v['ras'], ras_to_mime($v['ras']));
exit;
}

?>