<?
require "include/bittorrent.php";
dbconn();
if (!$CURUSER)
{
Header("Location: $BASEURL/DOX");
die;
}
$filename = substr($_SERVER["PATH_INFO"], strrpos($_SERVER["PATH_INFO"], "/") + 1);
if (!$filename)
die("Datei nicht vorhanden\n");
$filename = sqlesc($filename);
$res = mysql_query("SELECT * FROM data WHERE filename=$filename") or sqlerr();
$arr = mysql_fetch_assoc($res);
if (!$arr)
 die("Nicht gefunden\n");
mysql_query("UPDATE data SET hits=hits+1 WHERE id=$arr[id]") or sqlerr();
$file = "database/$arr[filename]";
header("Content-Length: " . filesize($file));
header("Content-Type: application/octet-stream");
readfile($file);
?>