gazalec Posted March 15, 2007 Share Posted March 15, 2007 Hi i have a little problem, on my website I allow users to enter the website as a guest or login, and if they continue as a guest they have the option to login on every page, the only problem is if they login they go to the login page after logging in they are directed to the welcome page again i was wondering if there was a way for them to login and return to the previous page, i know if could create a login page for every page and redirect them to each relative page but that would just be so inefficient i was just wondering if there was a way to attach the page (filename) to a session or cookie etc. Thanks in advance P.S I am currently using the header script to relocate them header("Location:welcome.php") Link to comment https://forums.phpfreaks.com/topic/42833-solved-page-history-problems/ Share on other sites More sharing options...
Orio Posted March 15, 2007 Share Posted March 15, 2007 On every page, add: $_SESSION['login_ref'] = basename($_SERVER['PHP_SELF']); Then redirect them to that var: header("Location: ".$_SESSION['login_ref']); This assumes that all of the files are in the same folder. Make the adjustments needed if you have different folders. Also, make sure you use session_start() on every page. Orio. Link to comment https://forums.phpfreaks.com/topic/42833-solved-page-history-problems/#findComment-207923 Share on other sites More sharing options...
gazalec Posted March 15, 2007 Author Share Posted March 15, 2007 Yeah that works perfectly thanks alot Link to comment https://forums.phpfreaks.com/topic/42833-solved-page-history-problems/#findComment-207926 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.