Kuroro Luc
04-24-2004, 05:00 PM
Hello, does anyone here know a download manager/tracker script (PHP) that can hide 'true url'?
so its like this, even when you download, the true url (path) is still hidden.. coz we dont want leechers to... u know...
Thanks.
download.php
----
<?php
// assuming $filename is defined
$basename = basename($filename);
header("Content-Length: ".filesize($filename));
header("Content-Disposition: attachment; filename=".$basename);
header("Content-Type: application/x-force-download; name=\"".$basename."\"");
readfile($filename);
?>
Good luck!
Kuroro Luc
04-24-2004, 05:27 PM
Thanks, I'm going to try it now...
I believe the $filename we change it into the file url path?
And how about built in the log script as well? every download is logged with counts and user information ( IP address, host name, file name, date, time, referring site and user agent. )
I gave you the basic algorithm. Everything else you have to figure out by yourself.
Programming is about thinking (c) null
Basic idea of logging with MySQL
$conn = mysql_connect('host', 'user', 'pass');
$selectDB = mysql_select_db('dbname');
$insert = mysql_query("INSERT INTO table (id, ipaddress, timestamp) VALUES (NULL, $_SERVER['REMOTE_ADDR'], time())");
$close = mysql_close($conn);
Informity
04-24-2004, 07:13 PM
I think null's just about nailed it.
An extension of that could be to make it query for past downloads from that IP and only allow one download per 5minutes, to stop download flooding (you'd want to check for X_FORWARDED_FOR in the $_SERVER global in case of transparent proxies such as the ones ntl: use)
Or you could make it check that an entry for that IP exists - an entry is added after they fill in a short form... etc.