<?

include_once '../../sys/inc/start.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';

if (!isset($_GET['id']) || !isset($_GET['size']))exit;
$size=intval($_GET['size']);
$if_foto=intval($_GET['id']);
$foto=mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id` = '$if_foto'  LIMIT 1"));

if ($size=='48')
{
if (is_file(H.'/files/gallery/48/'.$if_foto.'.'.$foto['ras'].''))
{
DownloadFile(H.'/files/gallery/48/'.$if_foto.'.'.$foto['ras'].'', 'Фото.'.$foto['ras'].'', ras_to_mime(''.$foto['ras'].''));
exit;
}
if (is_file(H.'/files/gallery/48/'.$if_foto.'.'.$foto['ras'].''))
{
DownloadFile(H.'/files/gallery/48/'.$if_foto.'.'.$foto['ras'].'', 'Фото.'.$foto['ras'].'', ras_to_mime(''.$foto['ras'].''));
exit;
}
if (is_file(H.'/files/gallery/48/'.$if_foto.'.'.$foto['ras'].''))
{
DownloadFile(H.'/files/gallery/48/'.$if_foto.'.'.$foto['ras'].'', 'Фото.'.$foto['ras'].'', ras_to_mime(''.$foto['ras'].''));
exit;
}
}
if ($size=='128')
{
if (is_file(H.'/files/gallery/128/'.$if_foto.'.'.$foto['ras'].''))
{
DownloadFile(H.'/files/gallery/128/'.$if_foto.'.'.$foto['ras'].'', 'Фото.'.$foto['ras'].'', ras_to_mime(''.$foto['ras'].''));
exit;
}
}
if ($size=='50')
{
if (is_file(H.'/files/gallery/50/'.$if_foto.'.'.$foto['ras'].''))
{
DownloadFile(H.'/files/gallery/50/'.$if_foto.'.'.$foto['ras'].'', 'Фото.'.$foto['ras'].'', ras_to_mime(''.$foto['ras'].''));
exit;
}
}
if ($size=='640')
{
if (is_file(H.'/files/gallery/640/'.$if_foto.'.'.$foto['ras'].''))
{
DownloadFile(H.'/files/gallery/640/'.$if_foto.'.'.$foto['ras'].'', 'Фото.'.$foto['ras'].'', ras_to_mime(''.$foto['ras'].''));
exit;
}
}
if ($size=='0')
{
if (is_file(H.'/files/gallery/foto/'.$if_foto.'.'.$foto['ras'].''))
{
DownloadFile(H.'/files/gallery/foto/'.$if_foto.'.'.$foto['ras'].'', 'foto_'.$if_foto.'.'.$foto['ras'].'', ras_to_mime(''.$foto['ras'].''));
exit;
}
}

?>