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.
Well, you know you're in a.php when you realize the log in is not valid. So save $_SERVER['PHP_SELF'] somewhere in the session or pass it along to the login page. After you re-validate the login, redirect back to the page that was saved in the session or URL. If no page was saved, then redirect to a default page.
Pick up the next copy of PHP|Architect, because I think I'm going to include a larger write up of this method as a tip. :)
-- ---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
PHP|Architect: A magazine for PHP Professionals – www.phparch.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php