Here ya go I minimized variable use, you could also do away with some of the if statements and opening the files locally would be a good idea to:
you may want to read this: http://www.suryvial.com/articles/1/3
<?php
//your domain
define('DOMAIN',"www.testuse.finditmax.com");
//folder that the hidden Downloads files are in, no lead or trailing slashes
define('FOLDER',"hid");
define('FILENAME',stripslashes(urldecode($QUERY_STRING)));
//if the filename is blank display an error page
if(FILENAME==""){
header ("Location: h ttp://" . DOMAIN . "/invalidfile.html");
exit;
}
list($remove,$stuff)=split('//',getenv("HTTP_REFERER"),2);
list($home,$stuff)=split('/',$stuff,2);
if ($home!=$domain){
header("Location: h ttp://" . DOMAIN . "/leecher.html");
exit;
}else{
$fp=@fopen("h ttp://" . DOMAIN . "/" . FOLDER ."/".$filename,"r");
if($fp){
if (ereg(".mp3",$filename)){header("Content-Type: audio/mpeg";}
elseif(ereg(".zip",$filename)){header("Content-Type: application/x-zip-compressed";}
elseif(ereg(".exe",$filename)){header("Content-Type: application/x-msdownload";}
else{header("Content-Type: application/octet-stream";}
header("Accept-Ranges: bytes");
header("Content-Disposition: ; attachment; Filename=$filename");
while (!feof($fp)) {
echo(fgets($fp, 4096));
} //end while
fclose ($fp);
}else{
header('Location: h ttp://' . DOMAIN . "/filenotfound.html");
exit;
} //end else
} //end else
?>