What about using a MySQL database? Insert the picture into a field in a table, then use a php script to call the data. I've been working on something like this. Is it practical, or am I barking up the wrong tree?
-----Original Message----- From: John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Thursday, February 27, 2003 12:20 PM To: 'merlin'; [EMAIL PROTECTED] Subject: RE: [PHP] Preventing the "hijacking" of pictures > I recently discovered the reason why the traffic is rising so high on my > server. Some people are "stealing" bandwidth. They include > the link of an image into a forum posting. Now everytime somebody reads > this > threat on the other site this image is > served by my server!! No one cares about one image, but they become > dramaticly a lot! > > Is there a reason how to find out that the image is not include into my > html > code, but into the other site code? > > A great idea would be showing a kind of a watermark on this images if they > are included inside other websites. > > $_SERVER[HTTP_REFERRER] does not help. But there might be another method I > do not know of. > > Thank you for any help and hints on this topic! The best way to handle this is probably with your web server. There are some rewrite rules that you can apply to the images/ directory that'll redirect a request for an image to another image if the request doesn't come from your site. We used to do this on a site I helped run. If someone tried to hotlink to one of our images, they got an add for some rather queer looking male swimsuits... :) Or, the other option is to implement this in PHP. Store your images outside of the web root. Serve them all up through a PHP page. <img src="foo.php?id=111"> foo.php will make sure that the request is valid by possibly checking a session value or HTTP_REFERRER. If the request is valid, send the headers and use readfile() to send the image data. If it's not, send the data for another image or nothing. The downside to this is it's harder to manage and all images requests will be running through PHP pages. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php