How can I separate announce urls with an empty line?
Example line:
http://img42.imageshack.us/img42/3658/ssanndl.png
My download.php:
Code:
<?php
@session_start();
if(isset($_SESSION['download']) && $_SESSION['download'] != '')
{
if(microtime(true) < ($_SESSION['download'] + 1.3))
{
$_SESSION['download'] = microtime(true);
preg_match(':^/(\d{1,10})/(.+)\.torrent$:', $_SERVER["PATH_INFO"], $matches);
header("Location: http://www.***.***/details.php?id=".(0+$matches[1]));
die();
}
}
$_SESSION['download'] = microtime(true);
set_time_limit(20);
require_once("include/bittorrent.php");
require_once("include/benc.php");
if (!$CURUSER) {
die('eject!');
}
if (!preg_match(':^/(\d{1,10})/(.+)\.torrent$:', $_SERVER["PATH_INFO"], $matches))
httperr();
$id = 0 + $matches[1];
if (!$id)
httperr();
$slots = slots($CURUSER['id'], $CURUSER['class']);
if($slots && $CURUSER['slot'] == 0)
{
$torrents = $slots[0];
#print_r($slots);exit;
if($slots[1] >= $slots[2] && !in_array($id, $torrents))
{
header("Location: ".$DEFAULTBASEURL."/slots.php");
exit;
}
}
$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();
header("Content-Type: application/x-bittorrent");
$dict = bdec_file($fn, filesize($fn));
if ($external == 'no')
unset($dict['value']['announce-list']); // remove multi-tracker capability
else {
$announce_str = $dict['value']['announce']['value'];
$infohash = pack("H*", sha1($info["string"]));
$scrape_url = str_replace('/announce', '/scrape', $announce_str);
$scrape_url = "$scrape_url?info_hash=".urlencode($infohash);
$announces = array(
$announce_str,
"$BASEURL/announce.php?passkey=$CURUSER[passkey]"
);
$dict['value']['announce-list']['type'] = 'list';
$dict['value']['announce-list']['value'] = array();
$dict['value']['announce-list']['value']['0']['type'] = 'list';
$dict['value']['announce-list']['value']['0']['value'] = array();
foreach ($announces as $announce) {
$dict['value']['announce-list']['value']['0']['value'][$announce]['type'] = 'string';
$dict['value']['announce-list']['value']['0']['value'][$announce]['value'] = $announce;
}
}
print benc($dict);
die();
?>