Hi,
I have the following antileech script which works great apart from one thing !
If I specify my domain as www.foo.com people can download ONLY if the url is www.foo.com/download.php?etc.
If they go to my site as http://foo.com they are treated as a leecher and thus can't download.
So what I need help with is to be able to specify 2 domains www.foo.com and foo.com as valid domains, that are not leechers.
Can anyone help ?
Here is my antileech script :
<?php
$domain="www.foo.com";
////////////////////////////////////////
$folder="/foo";
$filename=stripslashes(urldecode($QUERY_STRING));
$refr=getenv("HTTP_REFERER");
list($remove,$stuff)=split('//',$refr,2);
list($home,$stuff)=split('/',$stuff,2);
//can be replaced with
if ($home!=$domain){readfile("http://www.foo.com/index.php");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(".zip",$filename)){$xtype="application/x-zip-compressed";}
elseif(ereg(".exe",$filename)){$xtype="application/x-msdownload";}
elseif(ereg(".hpx",$filename)){$xtype="application/mac-binhex40";}
else{$xtype="application/octet-stream";}
Header("Content-Type: $xtype");
Header("Accept-Ranges: bytes");
Header("Content-Disposition: ; Filename=$filename");
readfile("http://".$domain."/".$folder."/".$filename);
}else{
//can be replaced with
//readfile("http://www.foo.com/error404.html");exit;
die("file not found");
}}
?>
Any suggestions would be really appreciated.
Thanks :-)