-
Notifications
You must be signed in to change notification settings - Fork 0
Download.php fix #1
Copy link
Copy link
Open
Description
InDiGo20141
opened on Apr 9, 2014
Issue body actions
"id бота на кого будет всё скачанное идти",
'passkey' => "соответственно его passkey",
);
if (ini_get('output_handler') == 'ob_gzhandler' && ob_get_length() !== false){
@ob_end_clean();
header('Content-Encoding:');
}
$id = (isset($_GET["id"]) ? intval($_GET["id"]):0);
if (empty($id) && !is_numeric($id))
stderr($tracker_lang['error'], $tracker_lang['invalid_id']);
$res = sql_query("SELECT name, size, owner, banned FROM torrents WHERE id = ".sqlesc($id)) or sqlerr(**FILE**, **LINE**);
$row = mysql_fetch_assoc($res);
if (!$row)
stderr($tracker_lang['error'], $tracker_lang['invalid_id']);
$fn = $torrent_dir."/".$id.".torrent";
if (!$row || !is_file($fn) || !is_readable($fn))
stderr($tracker_lang['error'], $tracker_lang['unable_to_read_torrent']);
if ($row['banned'] == 'yes' && $row['owner'] != $CURUSER['id'] && get_user_class() < UC_MODERATOR)
stderr($tracker_lang['error'], 'Упс, а торрентик-то забанен!');
sql_query("UPDATE torrents SET hits = hits + 1 WHERE id = ".sqlesc($id));
$name = str_replace(array(',', ';'), '', $name);
require_once "include/BDecode.php";
require_once "include/BEncode.php";
if($CURUSER) {
if (strlen($CURUSER['passkey']) != 32) {
$CURUSER['passkey'] = md5($CURUSER['username'].get_date_time().$CURUSER['passhash']);
sql_query("UPDATE users SET passkey = ".sqlesc($CURUSER["passkey"])." WHERE id = ".sqlesc($CURUSER["id"]));
} }
$dict = bdecode(file_get_contents($fn));
if (!empty($dict['announce-list'])) {
$dict['announce-list'][][0] = $announce_urls[0]."?passkey=$CURUSER[passkey]"; // Just add one tracker for multitrackers, we are the last
} else
$dict['announce'] = $announce_urls[0]."?passkey=$CURUSER[passkey]";//"$DEFAULTBASEURL/announce.php?passkey=$CURUSER[passkey]";
header ("Expires: Tue, 1 Jan 1980 00:00:00 GMT");
header ("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header ("Cache-Control: no-store, no-cache, must-revalidate");
header ("Cache-Control: post-check=0, pre-check=0", false);
header ("Pragma: no-cache");
//header ("X-Powered-by: TBDev Yuna Scatari Edition - http://bit-torrent.kiev.ua");
header ("Accept-Ranges: bytes");
header ("Connection: close");
header ("Content-Transfer-Encoding: binary");
header ("Content-Disposition: attachment; filename=\"[".$SITENAME."] ".$row["name"]."\"");
header ("Content-Type: application/x-bittorrent");
ob_implicit_flush(true);
print(BEncode($dict));
?>
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels