Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Community Cafe (http://www.bvlist.com/forumdisplay.php?f=18)
-   -   Download Issue (http://www.bvlist.com/showthread.php?t=3907)

DML 30th November 2009 18:23

Download Issue
 
Hi,

I'm having an issue when downloading torrents and I'm hoping someone here can help.
When clicking to download the .torrent file I get a Not Found error.
The script seems to get the details of the torrent from the database correctly, but then it doesn't seem to follow through.

Source: kDev.org Tork
PHP Version: 5.2

Download.php

PHP Code:

<?

require_once("include/bittorrent.php");

dbconn();

hit_start();

if (!
preg_match(':^/(\d{1,10})/(.+)\.torrent$:'$_SERVER["PATH_INFO"], $matches))
    
httperr();

$id $matches[1];
if (!
$id)
    
httperr();


hit_count();

$res mysql_query("SELECT name 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");

require_once 
"include/benc.php";



if (
strlen($CURUSER['passkey']) != 32) {

$CURUSER['passkey'] = md5($CURUSER['username'].get_date_time().$CURUSER['passhash']);

mysql_query("UPDATE users SET passkey='$CURUSER[passkey]' WHERE id=$CURUSER[id]");

}



$dict bdec_file($fn, (1024*1024));

$dict['value']['announce']['value'] = "$BASEURL/announce.php?passkey=$CURUSER[passkey]";

$dict['value']['announce']['string'] = strlen($dict['value']['announce']['value']).":".$dict['value']['announce']['value'];

$dict['value']['announce']['strlen'] = strlen($dict['value']['announce']['string']);



header('Content-Disposition: attachment; filename="'.$torrent['filename'].'"');

header("Content-Type: application/x-bittorrent");



print(
benc($dict)); 

hit_end();

?>

Thank you for your time.

Cheers,
DML

Phogo 9th December 2009 16:31

Check your chmod permissions, also your config file. make sure the downloads directory is correctly set.


All times are GMT +2. The time now is 23:02.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.