adam84 Posted August 25, 2008 Share Posted August 25, 2008 I have a number of pages that a user (not logged in), can visit. *each page have a form that allows a user to login What I want to do is, say a user is on a page and they decide to log in. I want to reload that same page that user was on prior to them being logged in, but now with them being logged in. * I hope that make sense, it is too early to think. Sorry Would I store the current page url in a session variable, valid the username and password and I would do something like: header("Location: " . $_SESSION['currentPage']); Am I on the right track? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted August 25, 2008 Share Posted August 25, 2008 Yes you'd set a session variable ($_SESSION['currentPage']) they was on before logging in. Once they have logged in you check to see the currentPage session variable exists. If it exists you redirect the user to the page they was previously on. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted August 25, 2008 Share Posted August 25, 2008 what I would do... is this: create a hidden field in the form, and save the current page: <input type="hidden" value="<?php echo $_SERVER['SCRIPT_URL']; ?>" name="currentPage" /> then on your login page use this redirect: header('Location: '.$_POST['currentPage']); Good Luck! Quote Link to comment Share on other sites More sharing options...
adam84 Posted August 25, 2008 Author Share Posted August 25, 2008 awesome thanks for you help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.