catalyst2 community forums  

Go Back   catalyst2 community forums > Support > Scripting Support

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old 25-06-2007, 09:11 AM   #1 (permalink)
SJG Photography
 
Join Date: Mar 2006
Location: South East - UK
Posts: 5
Blocking Hotlinking

I'm rebuilding my photography website and will be storing many more photographs on there in the future. I would like to prevent hotlinking of these images as this will eat into my bandwidth allocation.

Does anyone know an easy way to do this?

Regards,
Steve
__________________
http://www.sjgphotography.co.uk

Last edited by SGordon; 26-06-2007 at 10:50 AM.
SGordon is offline   Reply With Quote
Old 04-07-2007, 11:38 PM   #2 (permalink)
Registered User
 
fbridge's Avatar
 
Join Date: Apr 2003
Posts: 106
you will need to write a script which will check who the referrer is and respond accordingly. if it is your site then issue the image - if not then just ignore the request

i work in .asp and the variable is
Request.ServerVariables("HTTP_REFERER")

to send the image to the client then use

Response.ContentType = "image/jpeg"
Set oStream = Server.CreateObject("ADODB.Stream")
Response.BinaryWrite oStream.LoadFromFile("d:\domains\yourdomain.com\ww wroot\pathtoimage\image.jpg").Read
oStream.Close
Set oStream = Nothing

hope this helps


dotnet version here
http://support.microsoft.com/kb/306654
__________________
old dog - anxious to learn new tricks

Last edited by fbridge; 04-07-2007 at 11:51 PM. Reason: added more code
fbridge is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 01:51 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.