2012-12-26, 03:44:45
I have a PHP script that is rather old. It was used to prevent direct download of content.
I assume with the continued advances in PHP, the script itself needs some minor adjustments.
I would be willing to pay a reasonable fee for someone to take a look, debug it and fix it.
I assume with the continued advances in PHP, the script itself needs some minor adjustments.
I would be willing to pay a reasonable fee for someone to take a look, debug it and fix it.
Quote:<?php
//your domain, no http://
$domain="www.yourdomain.com";
//folder that the hidden Downloads files are in, no lead or trailing slashes
$folder="hid";
$filename=stripslashes(urldecode($QUERY_STRING));
if ($filename==""){readfile("http://www.yourdomain.com/invalidfile.html");exit;}
$refr=getenv("HTTP_REFERER");
list($remove,$stuff)=split('//',$refr,2);
list($home,$stuff)=split('/',$stuff,2);
if ($home!=$domain){readfile("http://www.yourdomain.com/leecher.html");exit;
}else{
$fp=@fopen("http://".$domain."/".$folder."/".$filename,"r");
if($fp)
{
if (ereg(".mp3",$filename)){$xtype="audio/mpeg";}
elseif(ereg(".zip",$filename)){$xtype="application/x-zip-compressed";}
elseif(ereg(".exe",$filename)){$xtype="application/x-msdownload";}
else{$xtype="application/octet-stream";}
Header("Content-Type: $xtype");
Header("Accept-Ranges: bytes");
Header("Content-Disposition: ; attachment; Filename=$filename");
while (!feof($fp)) {
echo(fgets($fp, 4096));
} //end while
fclose ($fp);
}else{
readfile("http://www.yourdomain.com/filenotfound.html")
;exit;
}
}
?>