Просмотр файла modules/mob_down.php

Размер файла: 788B
<?php
define( 'WBCAT', 1 );
define('SKRIPT_DIR', $_SERVER['DOCUMENT_ROOT']);
require_once (SKRIPT_DIR.'/inc/config.php');
$m=mysql_fetch_assoc(mysql_query('SELECT * FROM `down_fields` WHERE `id`='.intval($_SESSION['downid']).' LIMIT 0,1')); 
$down_set=mysql_fetch_array(mysql_query('SELECT * FROM  `down_set` WHERE `id`="1" LIMIT 0,1')); 
$settings['url']=str_replace('http://','',$settings['url']);
$filename=$settings['url'].'_'.$m['filename'];
$MY_FILE_PACH=SKRIPT_DIR.'/'.$down_set['filedir'].'/'.$m['adress'];
header("Content-Disposition: attachment; filename=\"{$filename}\"");
header("Content-type: application/octet-stream");
header("Content-length: ".filesize($MY_FILE_PACH));
ob_clean();
flush();
echo file_get_contents($MY_FILE_PACH);
unset($_SESSION['downid']);