Is there any way in PHP to disable ppl from using download managers from downloading files?
Plz help me if you can....
Is there any way in PHP to disable ppl from using download managers from downloading files?
Plz help me if you can....
Download managers usually open multiple connections with web server to increase download speeds... If u can restrict the user 1 connection at one time. u shud be good... Use sessions or cookies to see if user has more than 1 connection at a time.. there should be a way to do this by header() too...
Another nice option would be using fpassthru() to send file
TommYNandA
I'm sorry I wasn't clear enough before. Actually the thing is... I've created a downlaod script and the download url loads from the database like "download.php?id=13" so that people cannot view the actual file location.
But the problem is... if they use download managers, they can view the original download location whenever they click on download. I just don't want them to view that.
So my question is... how is that possible? Can you help?
P.S. I'm using a Windows Server and headers already sent.
Then you should go for fpassthru... here is an example of how to use fpassthru.. change Content Type accordingly
$filename="C:\somelocation\outof\webserverroot\";
$fn=fopen($filename,"r");
header("Content-Type: application/pdf\n");
header("Content-Disposition: attachment; filename=filename.pdf");
fpassthru($fn);
[\PHP]
This is an example for pdf document thru fpassthru... u shud be able to transfer any file like this.. You can place your file outside web server directory so that users cant access the file directly by any means except thru ur php file.
open this file in a new window so that you can send headers.
Good Luck
TommYNandA
This is the code i've used for the downlaod script. But I was unable to use fpassthru here.
if (isset($download_id)){
db_connect();
$sql = "SELECT url FROM fr_hiddenurl WHERE id='{$_GET['download_id']}'";
$result = mysql_query($sql);
if (mysql_num_rows($result) == 1) {
$request = mysql_result($result, 0);
}
if (!$request) {
$error = "Error. ";
include ("error.php");
exit();
}
else {
header("Location: $request");
}
}
Can you help now?
Have you read what the PHP Manual has to say about [man]fpassthru/man?
Yes I did read that. But I was unable to make it work...
EDITED:
All right. Now it's working. Thanks to you guys who helped me a lot. I just have one more question to ask. When I tried for the first time, it was getting the file from d:\server\www but now it's getting the file from localhost when I click download. Does that mean it's working perfectly now?