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.
Validate URL against URL for login script
Moderator: General Moderators
Re: Validate URL against URL for login script
Code: Select all
$host = $_SERVER['HTTP_HOST']; Re: Validate URL against URL for login script
Thank you that is a big helptimWebUK wrote:Is this what you're after? To grab the base URL of your site, then compare it the referrer?Code: Select all
$host = $_SERVER['HTTP_HOST'];
Re: Validate URL against URL for login script
The problem I am having now is when I click to login, the variable changes and it trys to send me back to the login page and not the page I came from. :/. How can I get around this?