Page 1 of 1

HTTP_REFERER

Posted: Wed Dec 31, 2003 1:19 am
by gimenei
Hello!

I'm building a payment gateway between my e-commerce site and 2checkout.com.

I'm using following Perl code to check that user is refered from 2Checkout.com.

I'm trying to write a similar code in PHP. Everything works fine when referer is a regular site, but when the referer is secure site (ex. https://www.2checkout.com), HTTP_REFERER variable is just empty!!

Could someone please help me with it? Any ideas?

Thank You!
Janno

@referers=("www.2checkout.com","2checkout.com");
&check_url;
sub check_url {
local($check_referer) = 0;
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 "Bad Referrer - Merchant should put in code to write to a log or mail themselves a
note to verify order was billed in 2Checkout.com system"; }
}

Posted: Wed Dec 31, 2003 1:37 am
by microthick
Basing my answer from this:
http://www.mail-archive.com/e-gold-tech ... 00350.html

You might be able to do something similar.

Here's what the dude suggested:
http://www.mail-archive.com/e-gold-tech ... 00351.html