Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PHP help needed
#1
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.

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;
}
}
?>
Reply


Messages In This Thread
PHP help needed - by saint - 2012-12-26, 03:44:45
RE: PHP help needed - by shawn_a - 2012-12-26, 05:08:43
RE: PHP help needed - by saint - 2012-12-27, 20:52:31
RE: PHP help needed - by JWH_Matthew - 2012-12-27, 23:14:25
RE: PHP help needed - by shawn_a - 2012-12-28, 04:13:00
RE: PHP help needed - by saint - 2013-01-02, 02:02:26
RE: PHP help needed - by shawn_a - 2013-01-02, 02:07:31
RE: PHP help needed - by saint - 2013-01-02, 03:18:47
RE: PHP help needed - by shawn_a - 2013-01-03, 00:14:13
RE: PHP help needed - by adam bucky - 2013-03-08, 01:36:18



Users browsing this thread: 1 Guest(s)