Forum Moderators: not2easy

Message Too Old, No Replies

New Technique for Hotlinking Discouragement

Interesting.... 11 day page load...

         

vincevincevince

3:28 pm on Nov 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have just made a lovely PHP script which, having sent the wrong image (as the standard method), sets the time limit to unlimited, and then proceeds to send spaces at the end of the image, at a rate of 1 byte per second, for about 11 days.

Isn't that lovely? The page with the hotlinked image never finishes loading, and displays my URL in the status bar continually :)

If you are lucky enough not to have a bandwidth limit then just send them as fast as they'll fly out. That will severely constrain the browser's bandwidth and stop them doing anything but leaving the page.

[edited by: vincevincevince at 3:30 pm (utc) on Nov. 17, 2005]

bcolflesh

3:29 pm on Nov 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So stop bragging and post it ;)

vincevincevince

3:33 pm on Nov 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




$yoursite="yourdomain.com";
if (((strlen($_SERVER[HTTP_REFERER])>0)&&(strpos($_SERVER[HTTP_REFERER],$yoursite)))¦¦( (strlen($_SERVER[HTTP_REFERER])==0) ))
{
// HERE RETURN YOUR IMAGE AS NORMAL (print file_get_contents(....))
}
else
{
//this is a hotlinked image
set_time_limit(0);
header("Content-type: image/png");
print file_get_contents("images/ad.png");
for ($a=0;$a<1000000;$a++)
{
print " ";
sleep(1);
}

*Change ¦¦ into true pipes not the broken ones you see here*

This is used (for me) in conjunction with a 404 trick (where the images are in another internal directory, and when links to images are made, it calls a php script via 404 which grabs the image from the directory and spews it out.

You can also use it with .htaccess / mod_rewrite methods of rewriting .jpg / .png etc. to a script.

<edit>
It will show 'images/ad.png' which although it displays will never stop loading whenever an image is hotlinked. It will show the correct image when the image is requested with no referer (helpful for images in google images etc).
</edit>

FourDegreez

2:22 am on Nov 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Wouldn't your server run low on threads if a lot of people view the hotlinked image? As long as your server is sending bits to a browser, it's tying up a thread.