News:

Wondering if this will always be free?  See why free is better.

Main Menu

PHP Download Code problem

Started by Alisha, July 14, 2004, 12:35:17 AM

Previous topic - Next topic

Alisha

I am posting this here, becuse soo many smart people! :) I belive its allowed to post non-SMF question here also? Well it is sorta SMF related becuse I want to bridge SMF with my Torrent Tracker. I have a Tracker, for LEGAL reasons. Yes, to trade (distribute) large (non-copyrighted) files without the use of badwidth.

Although, my tracker will not download the torrent file when browsed. I can not post the URLs here for the problem pages becuse membership is required.  I set up a test account l:smfsmf p:password on the tracker.

Although, here is the PHP that *I* belive has the problem.  Well the problem is I keep getting a 404 when I try to download the torrent file.

download.php (I assume Download instructions)

$res = mysql_query("SELECT firename 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");

header('Content-Disposition: attachment; filename="'.$torrent['filename'].'"');
header("Content-Type: application/x-bittorrent");


details.php (Where the link is to download the torrent)

print("<tr><td class=rowhead width=1%>Download</td><td width=99% align=left><a class=\"index\" href=\"download.php?id=$id\">" . htmlspecialchars($row["filename"]) . "</a></td></tr>");


I can send anyone the original complete files / tracker (open source) if needed! I really need help on this. I have a friend that wants to help me bridge this to SMF, although, we need to get it working first. 

Path to the torrent file:

/home/msalisha/tracker.evilsolutions.com/torrents/3.torrent

Thanks!


[Unknown]

Can I see a phpinfo for the server you're running this on?

(A file with <?php phpinfo();?> in it.)

-[Unknown]


[Unknown]

Can you access the torrent files directly?

-[Unknown]

Alisha

Yes, if I enter the direct URL in the addy bar!

http://tracker.evilsolutions.com/torrents/2.torrent

[Unknown]

Can you temporarily replace this:

$fn = "$torrent_dir/$id.torrent";

With this:

echo $fn = "$torrent_dir/$id.torrent";

And see what it says then?

-[Unknown]

Alisha

#6
I had to revert back to a original file becuse I tried another known fix! I changed the file you requested, and I am back to:

No input file specified.

Becuse of the changes I made, I had to delete and upload the torrent again, New Url:

http://tracker.evilsolutions.com/download.php/3/KCMO-SM04.torrent

Download.php

$res = mysql_query("SELECT name FROM torrents WHERE id = $id") or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_assoc($res);

echo $fn = "$torrent_dir/$id.torrent";
//$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");



details.php

print("<tr><td class=rowhead width=1%>Download</td><td width=99% align=left><a class=\"index\" href=\"download.php/$id/" . rawurlencode($row["filename"]) . "\">" . htmlspecialchars($row["filename"]) . "</a></td></tr>");


Path to Torrent file:

ftp://ftp.dancedancekc.com/tracker.evilsolutions.com/torrents/3.torrent


Alisha

Seems that this Tracker is Unuseable for whatever reason, I am not looking at other software to use...

Thanks for all you help! :)

Advertisement: