Web Hosting Talk







View Full Version : Wanted: Code to Stop Images from Particular Domain Loading on my Own Site


BLazeD
06-29-2006, 02:59 AM
Hi there

I am after a piece of code that will stop images coming from other domains from loading on my own website.

For example, I create a webpage, and then a spammer comes along and posts a whole bunch of images from a particular domain (e.g. spam.com). How do I stop all images from the domain spam.com appearing on my own website?

Thanks.

PS: I am not after an anti-spam solution or something like that, I just need the code to let me achieve the above.

freak
06-29-2006, 09:45 AM
How about stripping out any posts with "<img src=\"http://spam.com"? That will be an easy fix...

Use the strpos (I get confused with C, Java, PHP and other random languages, so don't blame me if I am wrong) function ;)

hyperspin
06-29-2006, 02:16 PM
If you're using Apache, see http://underscorebleach.net/jotsheet/2004/11/stop-image-hotlinking-tutorial-htaccess-apache

TheIcy.net
06-29-2006, 09:08 PM
There would be two ways, either editing the pages you have at the moment (PHP/ASP) to strip the images containing bad urls or if you are using apache then use a .htaccess rule to parse all page requests through a script that strips out the urls.