View Single Post
  #1  
Old 10th December 2013, 14:20
rtmrtm's Avatar
rtmrtm rtmrtm is offline
Member
 
Join Date: Jan 2010
Posts: 12
Red face download.php Please help
First Hello
The problem is

I want When a user Download external torrents my announce-list Enters In torrent File Automatic


Example

PHP Code:
http://localhost/rrm/announce.php?passkey=86c30c6fa20f0dab26ff5840894d9b14
http://Web external /0e75fa5ef298d1e1b41b960ba5b2f15e/announce 
I know that changing it in download.php But I Ask for help

This Must be changed

PHP Code:
require_once "backend/benc.php";

//if user dont have a passkey generate one, only if tracker is set to members only
if ($site_config["MEMBERSONLY"]){
     if (
strlen($CURUSER['passkey']) != 32) {
         
$rand array_sum(explode(" "microtime()));
         
$CURUSER['passkey'] = md5($CURUSER['username'].$rand.$CURUSER['secret'].($rand*mt_rand()));
         
mysql_query("UPDATE users SET passkey='$CURUSER[passkey]' WHERE id=$CURUSER[id]");
     }
}

if (
$row["external"]!='yes' && $site_config["MEMBERSONLY"]){// local torrent so add passkey
     
$dict bdec_file($fn, (1024*1024));

     
$dict['value']['announce']['value'] = "$site_config[SITEURL]/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']);
     unset(
$dict['value']['announce-list']);


     
header('Content-Disposition: attachment; filename="'.$name.'"');

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

     print(
benc($dict));

}else{
// external torrent so no passkey needed
     
header('Content-Disposition: attachment; filename="'.$name.'"');

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

     
readfile($fn);
}

mysql_close();

?> 
Thanks for any help
Reply With Quote