RE: [PHP] Redirection Question
| From: | Beauford.2005 | Date: | Wed, 23 Jul 2003 22:33:33 +0000 |
| Subject: | RE: [PHP] Redirection Question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-156349@lists.php.net to get a copy of this message | ||
Maybe I didn't explain enough. What if they come from b.php or c.php.
How do I automatically log what page they tried to access. So hard
coding login.php?next=a.php would only work for one page.
TIA
-----Original Message-----
From: Curt Zirzow [mailto:curt@zirzow.dyndns.org]
Sent: July 22, 2003 4:16 PM
To: PHP
Subject: Re: [PHP] Redirection Question
* 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."
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php