Bravo List
Register
Go Back   > Bravo List > P2P > Forum > Community Cafe
Notices

Reply
  #1  
Old 30th November 2009, 18:23
DML DML is offline
Member
 
Join Date: May 2009
P2P
Posts: 1
Default 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 = 0 + $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
Reply With Quote
  #2  
Old 9th December 2009, 16:31
Phogo's Avatar
Phogo Phogo is offline
VIP
 
Join Date: Jan 2008
United Kingdom
Posts: 902
Default
Check your chmod permissions, also your config file. make sure the downloads directory is correctly set.
Reply With Quote
Reply

Tags
download , issue

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 23:45. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2026, vBulletin Solutions Inc.