<?php
if($_SERVER['REMOTE_ADDR']!==$_SERVER['SERVER_ADDR'])exit;
define('THIS_SCRIPT', 'downfile');
define('ISDVBBS',true);
define('ROOT_PATH', "../");
define('INC_PATH', ROOT_PATH.'inc/');
!@is_dir(INC_PATH) AND exit('');
require_once INC_PATH.'config.php';
require_once INC_PATH.'dv_clssql.php';
$db= new sqldb();
$db->connect($dbhost, $dbuser, $dbpw, $dbname , $charset,$pconnect); 
$dfid=intval($_GET['dfid']);
$filefield=($_GET['a']==""||$_GET['a']!="r")?"filebinary":"rawbinary";
$query=$db->query("select {$filefield} as filebin from {$dv}sysfiles where id={$dfid}");
$rs=$db->fetch_array($query);
$filestr=base64_decode($rs["filebin"]);
$db->close();
echo $filestr;
?>