forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Miscellaneous => Topic started by: sigepjedi on June 17, 2004, 05:17:27 pm

Title: HOTLINKING
Post by: sigepjedi on June 17, 2004, 05:17:27 pm
I have read all the posts on Hotlinking, and unfortunatly the .htaccess will not work for me on my windows box.

I have two primary pages that I am seeing is getting hit with Hotlinking:
1.) viewImage.php
     This was added as a mod for watermarking the image

2.) get_file.php
     

Both of these are being hotlinked, and I would like to do some http referer checking at the tops of these to prevent the hotlinking. I realize this isnt 100%, but its better than nothing. Im not too good with php, but code in coldfusion.

I basiclly want to check the referer at the top, and if its contained in a list of allowed sites, allow the page to continue processing as normal. If its not contained in the allow list of sites, then display a different image.

Thanks in advance.
Title: Re: HOTLINKING
Post by: Joachim Müller on June 20, 2004, 12:34:12 am
what exactly is your question, you seem to know pretty well what you're doing. You'll need something like
Code: [Select]
if ($HTTP_REFERER == 'http://foo.com' || $HTTP_REFERER == 'http://bar.com') {
// here goes the regular code from the file
} else {
print 'You're a nasty boy, you mustn't hotlink my pages';
}

GauGau