Gossamer Forum
Quote Reply
check referer
Hi,

Using a part of the Problem.cgi posted by Dave recently - you can use this global to help protect content - as you will only allow the pages to be shown if the user is browsing to the page from your site..

Just thought it might be useful for some...

Simply insert:

<%check_refer%> at the top of the page you want to protect and then use the following global:


Code:
sub {
my (@referers, $referer, $check_referer);

@referers = ( "YOUR_IP" , "YOUR_DOMAIN" );

if ($ENV{"HTTP_REFERER"}) {
foreach $referer (@referers) {
if ($ENV{"HTTP_REFERER"} =~ m|https?://([^/]*)$referer|i) {
$check_referer = "1";
last;
}
}

}
else {
$check_referer = "1";
}

if ($check_referer != 1) {
print $IN->header();
print Links::SiteHTML::display ('error', { error => Links::language('PAGE_REFER') });
return;
}

}


Klaus

http://www.ameinfo.com