...

View Full Version : Redirecting code help



Snitz
10-06-2008, 09:42 AM
Hello,

I'm having a hard time creating a code on a page that if the user is coming from PAYPAL.COM he will be allowed to access it and if the user is entering the page from any other place but not paypal, his access will be denied.

Can you please help?

ess
10-06-2008, 10:12 AM
Check the contents of the $_SERVER['HTTP_REFERER'] and ensure that it contains paypal.com

You should also check the http request method (post, get, update..etc.) and handle the request accordingly.

Snitz
10-06-2008, 11:29 AM
Would this work?


if (strstr($_SERVER['HTTP_REFERER'],"paypal.com")) {
header ("Location: finish.php");
} else {
header ("Location: http://yahoo.com");
}

ess
10-06-2008, 04:05 PM
I guess it does and it does not.

it does not...because you're sending people away from your website...where you should handle their request and perhaps present an error page such as bad request or something along those lines.

rafiki
10-06-2008, 04:10 PM
Would this work?


if (strstr($_SERVER['HTTP_REFERER'],"paypal.com")) {
header ("Location: finish.php");
} else {
header ("Location: http://yahoo.com");
}


if (strstr($_SERVER['HTTP_REFERER'],"paypal.com")) {
include_once(finish.php);
} else {
header ("Location: http://yahoo.com");
}

Snitz
10-06-2008, 04:12 PM
Could help me fix it? Please!

Daniel Israel
10-06-2008, 05:44 PM
Just FYI...

I've found that using the HTTP_REFERER is problematic. You don't always get it, so someone might, in fact, be coming from paypal.com and you'd still be denying them.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum