I installed this and it works good. but i have a little problem.
When i download torrent file like "abcd.torrent" , IE6 changes filename to "abcd[1].torrent".
FF2 works perfectly but IE6.
how to fix it?
here my download.php
Code:
<?php
require_once ($rootpath . 'include/bittorrent.php');
dbconn();
loggedinorreturn();
maxsysop ();
parked();
@ini_set('zlib.output_compression', 'Off');
@set_time_limit(0);
if (@ini_get('output_handler') == 'ob_gzhandler' AND @ob_get_length() !== false)
{ // if output_handler = ob_gzhandler, turn it off and remove the header sent by PHP
@ob_end_clean();
header('Content-Encoding:');
}
getvar('id');
int_check($id,true);
$gigs = $CURUSER['downloaded'] / (1024*1024*1024);
$ratio = (($CURUSER['downloaded'] > 0) ? ($CURUSER['uploaded'] / $CURUSER['downloaded']) : 0);
if (($CURUSER['downloadpos'] == 'no' OR $usergroups['candownload'] == 'no' OR $usergroups['candownload'] != 'yes') OR ($gigs > '5' AND $ratio <= 0.4 AND $CURUSER['downloaded'] <> 0)) {
print_no_permission();
exit;
}
$res = sql_query("SELECT torrents.name, torrents.filename, torrents.size, torrents.owner, categories.minclassread AS minclassread FROM torrents LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_array($res);
if ($CURUSER['class'] < $row['minclassread'])
print_no_permission();
$fn = "$torrent_dir/$id.torrent";
if (!$row || !is_file($fn) || !is_readable($fn))
httperr();
sql_query("UPDATE torrents SET hits = hits + 1 WHERE id = ".sqlesc($id)) or sqlerr(__FILE__, __LINE__);
require_once ($rootpath . 'include/benc.php');
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 = 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']);
if($CURUSER['id'] != $row['owner'])
sql_query("INSERT INTO torrent_hit (uid,id,name,size) VALUES(".sqlesc($CURUSER['id']).", ".sqlesc($matches[1]).", ".sqlesc($row['name']).", ".sqlesc($row['size']).")") or sqlerr(__FILE__, __LINE__);
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: ".VERSION." (c) ".date("Y")." ".$SITENAME);
header ("Accept-Ranges: bytes");
header ("Connection: close");
header ("Content-Transfer-Encoding: binary");
header ("Content-Type: application/x-bittorrent");
header ("Content-Disposition: attachment; filename=\"".$row["filename"]);
ob_implicit_flush(true);
print(benc($dict));
?>