我在修改BT发布程序时遇到了这个问题,反复修改就是不行!该文件名为download.php,是用来下载torrent文件的。
第一段代码是在页面上显示的连接。
print("
| 下载 | " . htmlspecialchars($row["filename"]) . " |
");
下面的代码为download.php文件的内容。
<?
require_once("include/bittorrent.php");
////连接数据库
dbconn();
hit_start();
if (!preg_match(':^/(\d{1,10})/(.+)\.torrent$:', $_SERVER["PATH_INFO"], $matches))
httperr();
if (!$id)
httperr();
$id = intval($id);
hit_count();
$res = mysql_query("SELECT 1 FROM torrents WHERE id = $id") or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_assoc($res);
$fn = $torrent_dir."/".$id.".torrent";
if (!$row || !is_file($fn) || !is_readable($fn))
httperr();/////出错提示
mysql_query("UPDATE torrents SET hits = hits + 1 WHERE id = $id");
header("Content-disposition: filename=".$file);
header("Content-Type: application/x-bittorrent");
readfile($fn);
hit_end();
?>
以上为修改是最初的代码,由于这个地方我修改没有成功(不过其他的都能用了),所以把最初的拿上来,请各位高手指教!