Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Cant find error in this code...

Quote Reply
Cant find error in this code...
I dont want people to be able to access any of the cgi files without being referred from my site, so at the top of each file I have replaced main(); with...

my ($found);
my @ref = ('.audio-grabber.com');
if (@ref) {
$found = 0;
if ($ENV{'HTTP_REFERER'}) {
foreach (@ref) { $ENV{'HTTP_REFERER'} =~ /\Q$_\E/i and $found++ and last; }
}
if (! $found) {
print "Content-type: text/html \n\n";
print "You cannot access this script because you have not been referred from Audio-Grabber.";
exit;
}
} else {
main();
}


When I try to access the cgi scripts through my browser if gives the correct error saying that they arent allowed to access the file, but when they click a link to the script from my website it gives an internal server error...why is this?


Thanks!

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Subject Author Views Date
Thread Cant find error in this code... Paul 2359 Jan 7, 2001, 6:30 AM
Thread Re: Cant find error in this code...
pugdog 2276 Jan 7, 2001, 10:02 AM
Post Re: Cant find error in this code...
Paul 2255 Jan 7, 2001, 10:08 AM
Thread Re: Cant find error in this code...
Paul 2283 Jan 7, 2001, 10:12 AM
Thread Re: Cant find error in this code...
pugdog 2293 Jan 7, 2001, 11:10 AM
Post Re: Cant find error in this code...
Paul 2258 Jan 7, 2001, 11:12 AM