Просмотр файла up/download.php

Размер файла: 1.76Kb
<?php
require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"../template/functions.php";
require_once"../template/antidos.php";
require_once"../template/cookies.php";
require_once"../template/gzip.php";
require_once"../template/header.php";
require_once"../template/referer.php";

// Инклуд главных файлов

require_once "moduls/config.php";
require_once "moduls/functions.php";
require_once "moduls/connect.php";

$id = abs((int)$_GET['id']);

$f = mysql_fetch_array(mysql_query("SELECT * FROM `".$preff."_files` WHERE `id` = '".$id."'"));
$fid = "$f[fname].$f[format]";
$path = $f['path'];

if(is_file($path)){
if ($auth || $guest_file=="1"){

if (!$_SESSION[$path]){
mysql_query("UPDATE `".$preff."_files` SET `loads`='".($f['loads']+1)."', `timeload`='".time()."' WHERE `id`='".$id."'");
$_SESSION[$path]="1";
}

header("Location: $path");
exit;

} else {

include_once"../themes/$config_themes/index.php";
echo '<img src="../images/img/partners.gif" alt=""> <b>Скачивание файла</b><br><br>';
echo 'Вы не авторизованы, чтобы скачать файл <b>'.check($fid).'</b> необходимо<br>';
echo '<b><a href="../pages/vhod.php?'.SID.'">Авторизоваться</a></b> или в начале <b><a href="../pages/registration.php?'.SID.'">Зарегистрироваться</a></b><br><br>';}
echo'<img src="../images/img/reload.gif" alt=""> <a href="index.php?'.SID.'">В архив файлов</a><br>';
echo'<img src="../images/img/homepage.gif" alt=""> <a href="../index.php?'.SID.'">На главную</a>';
include_once"../themes/$config_themes/foot.php";

} else header("Location: index.php?");
?>