Location: PHPKode > projects > Trunk.net > getdox.php
<?
require "include/functions.php";
dbconn();
if (!$CURUSER)
{
header("Location: ".$BASEURL);
die;
}
$filename = substr($_SERVER["PATH_INFO"], strrpos($_SERVER["PATH_INFO"], "/") + 1);
if (!$filename)
  stderr( _("Error"), _("Filename missing") );
  
if (get_user_class() < UC_POWER_USER && filesize("$DOXPATH/$filename") > 1024*1024)
  stderr( _("Error"), _("Sorry, you need to be a power user or higher to download files larger than 1.00 MB.") );
  

$filename = sqlesc($filename);
$res = do_mysql_query("SELECT * FROM dox WHERE filename=$filename") or sqlerr();
$arr = mysql_fetch_assoc($res);
if (!$arr)
stderr( _("Error"), _("File Not found"));
do_mysql_query("UPDATE LOW_PRIORITY dox SET hits=hits+1 WHERE id=$arr[id]") or sqlerr();
$file = "$DOXPATH/$arr[filename]";
header("Content-Length: " . filesize($file));
header("Content-Type: application/octet-stream");
readfile($file);
?>
Return current item: Trunk.net