Re: Redirection Question

From: Date: Tue, 22 Jul 2003 20:16:26 +0000
Subject: Re: Redirection Question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-156316@lists.php.net to get a copy of this message
* Thus wrote Beauford.2005 (beauford.2005@rogers.com): > Hi, > > I am trying to figure out how to redirect a user back to a page but not > having much luck. > > For example: I click on a menu item on my site which goes to a.php. This > file includes another file that determines if they are logged in or not. > If not, they are sent to login.php using header(:Location: .... ). How > would I automatically redirect them back to a.php after they have logged > in successfully. I have tried using HTTP_REFERRER, but it isn't > redirecting. You can use the HTTP_REFERRER, but i wouldn't depend on it, it isn't a required header for the client. what you prolbably should do is when the arn't logged int, you can send them to something like: header('location: login.php?next=a.php'); Then on your login form add a hidden variable: <input type="hidden" name="next" value="<?echo $_GET['next']?>"> Finally when the user submits this form, and the user logs in successfully you know that you need to redirect them to the a.php. HTH, Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#156316) next »