Group,

 

I discovered recently that a newly released website is hotlinking a
loading.gif image off my site.

 

I am of the mindset that if you are going to hotlink like that, prepare to
get pooed on.

 

To keep this on-topic, here is a portion of the PHP script that I used to
select which image is displayed to the unfortunate viewer (I know it is
probably easier/faster/cleaner to do with mod_rewrite rules, but this is a
PHP mailing list!):

 

if(strpos(strtolower($_SERVER['HTTP_REFERER']),'mudah') &&
$_SERVER['REMOTE_ADDR'] != 'OFFENDING_DEVELOPER_IP_ADDRESS') {

                header('Content-Type: image/jpeg');

                readfile('images/poo.jpg');

}

else {

                header('Content-Type: image/gif');

                readfile('images/loading2.gif');

}

 

There are a couple of smarts:

a)      If the viewer is the developer (which I can only tell from the IP
address that originally found my image via Google Images - yay for Apache
logs) then the original 'loading.gif' image is displayed.

b)      If the referrer doesn't contain 'mudah' (a porton of the site
address), then the original 'loading.gif' image is displayed. This is so
that people who visit a direct link (including the Google Imagebot) won't
see the new image. This makes it perfectly safe to click
http://www.kennedytechnology.com/images/loading.gif

 

I don't want to type out the address for the offending site, because the
developer may see this thread in his/her referrals. But if you wish to see
the new version of the site you can do so by typing
(one)(two)(three)mudah(dot)com.

 

Anyone else done similar things for people who choose to hotlink and steal
your bandwidth?

 

Thanks,

Nathan.

 <http://www.kennedytechnology.com> http://www.kennedytechnology.com

 

Telerobotics project:

 <http://control.kennedytechnology.com> http://control.kennedytechnology.com

 


--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to