Hello,
I found this wonderful anti-leech-script which effectively conceals the location on the server where a particular file is loaded from. The script is added to the end of this message.
It basically streams the file to the browser and only does so, if certain criteria (anti-leech test) are fulfilled. Great script!
My problem:
I want to use this script to stream pictures to the browser. Tested it, works like a charm.
BUT
I have no HTML-code "wrapped" around it. So I cannot add anything to the picture. The picture is the only object in the browser window and I can't add any text or JavaScript or other pictures to it.
Question:
Does anybody know how to expand the script so that there actually is an HTML-page in the browser that displays the picture-file?
My assumption is, that it is not possible. But maybe someone in this community knows a way to do it. Thanks a lot for your help!
Greetings
Reinhard
here's the script...
-------------
<?php
//------------------------
----------
----
//
// Name: Very Good Anti-Leech Script
// Description:This is the best anti-lee
// ch 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 strea
// ms it through the script. This example d
// emonstrates various functions of PHP.
// By: Steve Oliver
//
// Inputs:$domain - your domain name.
// $folder - folder that your files are in.
//
//This code is copyrighted and has // limited warranties.Please see
http:////
www.Planet-Source-Code.com/xq/ASP/txtCodeId.286/lngWId.8/qx/vb/scripts/ShowCode.htm// for details.
//------------------------
----------
----
/*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.*/
$domain="
www.mydomain.com"
; //your domain
$folder="myfolder"; //folder that the files are in, no lead or trailing slashes
$filename=stripslashes(url
decode($QU
ERY_STRING
));
//this can be replaced with
//if ($filename==""){readfile("
http://www.yourdomain.com/invalidfile.html");exit;
}
if ($filename==""){die("<h1>I
nvalid File Request...</h1>");}
$refr=getenv("HTTP_REFERER
");
list($remove,$stuff)=split
('//',$ref
r,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://".$doma
in."/".$fo
lder."/".$
filename,"
r");
if($fp)
{
if (ereg(".mp3",$filename)){$
xtype="aud
io/mpeg";}
elseif(ereg(".zip",$filena
me)){$xtyp
e="applica
tion/x-zip
-compresse
d";}
elseif(ereg(".exe",$filena
me)){$xtyp
e="applica
tion/x-msd
ownload";}
else {$xtype="application/octet
-stream";}
Header("Content-Type: $xtype");
Header("Accept-Ranges: bytes");
Header("Content-Dispositio
n: ; Filename=$filename");
readfile("
http://".$domain
."/".$fold
er."/".$fi
lename);
}
else
{
//this can be replaced with
//readfile("
http://www.yourdomain.com/filenotfound.html"
);exit;
die("file not found");
}
}
?>