Gossamer Forum
Home : General : Perl Programming :

HTTP_REFERER

Quote Reply
HTTP_REFERER
Can someone please tell me why the refered page is not stored in the $referer variable? As far as I know that should work!

$referer = $ENV{'HTTP_REFERER'};

I've also tried;

$referer = $ENV{HTTP_REFERER};

PLEASE HELP! This is driving me mad!

Andy


webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: HTTP_REFERER In reply to
Maybe there is no referer Wink

Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: HTTP_REFERER In reply to
So it should work? It has me stumped. I am trying to check if the referer is Clickbank. Maybe I will have to use some other way to validate that it is from Clickbank Frown This was would have been so much easier...lol

Andy

webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: HTTP_REFERER In reply to
If there is no referer, $referer will be empty.

To check if the referer is clickbank try something like:

Code:
if (grep { /clickbank\.com/i } $ENV{HTTP_REFERER}) {
print "Yes";
} else {
print "No";
}
...as far as I know that should work.




Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: HTTP_REFERER In reply to
Oh well, it came up with No. I don't quite understand how it cna not think there is a referer though Frown I suppose I will have to make up some other way to make the page a bit more secure....

Andy

webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: HTTP_REFERER In reply to
How are you testing it?

In Reply To:
I don't quite understand how it cna not think there is a referer though
Well if you go to a link directly in your browser then you are not being referred from anywhere so that is one case when HTTP_REFERER won't be defined (there are more).

To be able to test your script you would have to be clicking a link back to your site from clickbank.com - that is the only way HTTP_REFERER will be clickbank.com



Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: HTTP_REFERER In reply to
Yeah, it is coming from ClickBank.com. I made a test purchase (by setting the cost to $0), and then tried a complete test. To test the code you gave me, I made another link, and created a script with the code you gave. That just produced "No" Frown

Don't worry though, I am just doing it another way now Smile

Andy

webmaster@ace-installer.com
http://www.ace-installer.com