Image Anti-Leech

J

John Smith

Hi,

I've been trying to play around with a simple script to stop people stealing
images (and bandwidth) but without much success :

strFolder="imageshidden"

strServer = lcase(Request.ServerVariables("server_name"))
If strServer="www.joebloggs.com" Then
strPic = strFolder & Request.QueryString("pic")
Else
strPic = "img/youarestealing.gif"
End If
Response.Redirect strPic


Is there an online tutorial or script for this ?

Thanks

John
 
B

Boris Nikolaevich

I think it would make more sense to test for the referring page, rather than
the server name... in other words, if the request for the image came from a
page on your server, display the image; otherwise display the alternate
image. I think the name is HTTP_REFERER but my memory might be off.

A few notes about this, though: since your "real" image is available as
yourdomain.com/imageshidden/realimage.gif, it's still possible for someone
to download it. Your script is a slight deterrent, not a prevention.

I have had problems with some browsers not including the HTTP_REFERER header
when loading images (or scripts) for a page. For the site visitors who are
using these browsers--IE for Mac is one of them--the "you are stealing"
image would always be displayed, even when the visitor tried to load the
page correctly.

The best advice I have heard--and it's been posted many times, in many
different groups--is "don't post images that you absolutely don't want
anyone to download." That's the only sure-fire way to prevent leeching.
 
J

John Smith

Boris,

Thanks for that, I'll have a go at using the REFERER and also disabling the
script if the USER_AGENT is a Mac.

Thanks

John
 
A

Alan

I remember seeing an article on the different methods to try, but I can't
remember where - sorry. One solution involved setting the image source as
the background attribute of a TD tag, and then putting a transparent gif in
the TD so that it overlays the 'real' image. When a use r-clicks the image
they get the properties/source of the transparent gif. Never tried this, but
I imagine the first stumbling block will be browser compatibility. Have you
tried a Google search? I doubt there's any foolproof way.

Alan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,091
Messages
2,570,605
Members
47,225
Latest member
DarrinWhit

Latest Threads

Top