//************************************** // Name: Very Good Anti-Leech Script // Description:This is the best anti-leech script out there. There is now way at all to tell where a file is coming from. What it does is open the file, and streams it through the script. This example demonstrates various functions of PHP. // By: Steve Oliver (from psc cd) // // // Inputs:$domain - your domain name. $folder - folder that your files are in. // // Returns:None // //Assumes:None // //Side Effects:None //************************************** <?php /*Anti-Leech script by Steve Oliver This is the best anti-leech out there. No way of telling where the file is coming from. Set the 2 variables below, $domain and $folder. You can replace the errors below where commented with html files if wanted.*/ //your domain $domain="www.yourdomain.com"; //folder that the files are in, no lead or trailing slashes $folder="filefolder"; $filename=stripslashes(urldecode($QUERY_STRING)); //this can be replaced with //if ($filename==""){readfile("http://www.yourdomain.com/invalidfile.html");exit;} if ($filename==""){die("<h1>Invalid File Request...</h1>");} $refr=getenv("HTTP_REFERER"); list($remove,$stuff)=split('//',$refr,2); list($home,$stuff)=split('/',$stuff,2); //this can be replaced with //if ($home!=$domain){readfile("http://www.yourdomain.com/leecher.html");exit; if($home!=$domain){die("<h1>Leecher!</h1>This file is from $domain"); }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: ; Filename=$filename"); readfile("http://".$domain."/".$folder."/".$filename); }else{ //this can be replaced with //readfile("http://www.yourdomain.com/filenotfound.html");exit; die("file not found"); }} ?>