I would recommend adding no-caching headers for the "poo" version of
the image. Otherwise if they then happened to come through to your
website after visiting the other one, they're probably still going to
see the "poo" image instead of your loading one.

This has happened to me in the past where I served up an image
advertising one of my sites if it was hot-linked. Then if the user
typed in the domain name and visited the site they saw the ad image
instead of the regular ones because of caching.

Cheers,
Chris


2009/8/7 Nathan Kennedy <[email protected]>:
> 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
>
>
>
> Telerobotics project:
>
> http://control.kennedytechnology.com
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature
> database 4313 (20090806) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.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