Validate URL against URL for login script
Posted: Thu Dec 17, 2009 12:23 pm
Hey everyone,
Perhaps I am going about this the wrong way but basically here is where I am at:
When someone goes to http://www.myurl.com/blah/cool if they are not logged in it takes them to the login page (http://www.myurl.com/login/login.php. Once they log in it sends them to just http://www.myurl.com/blah and not the page they wanted to get to.
basically, if they came from say google I dont want them to be redirected back to google when they login.
So here is what I have:
$ref=@$HTTP_REFERER;
if ($ref == "http://www.myurl.com/") {
echo $ref;
}
else {
echo "URL not valid";
}
How can I find the base URL of $ref and make sure it matches my URL then have it direct to that page once they log in.
Perhaps I am going about this the wrong way but basically here is where I am at:
When someone goes to http://www.myurl.com/blah/cool if they are not logged in it takes them to the login page (http://www.myurl.com/login/login.php. Once they log in it sends them to just http://www.myurl.com/blah and not the page they wanted to get to.
basically, if they came from say google I dont want them to be redirected back to google when they login.
So here is what I have:
$ref=@$HTTP_REFERER;
if ($ref == "http://www.myurl.com/") {
echo $ref;
}
else {
echo "URL not valid";
}
How can I find the base URL of $ref and make sure it matches my URL then have it direct to that page once they log in.