Hi, I need to redirect to last page visited when the session has expired, sometimes the users are working in a form or viewing some records, then the users receive a call or something, then when they want to continue the session has expired and then they have to login again. So, I want to remember the last page visited and after login go to it.
- Now, when the session is active i always save the page's name in a SESSION var
- if the session is expired, in the login.php page I put this code:
if(isset($_SESSION[ 'pagbus' ])){
$xpagina=$_SESSION[ 'pagbus' ];
header('Location: $xpagina');
}
but nothing happens, the user is always redirected to the main page.
my questions are:
1. when the session has expired, the global vars are deleted from memory?
2. to do this is better to use cookies instead of session vars?
3. can I recall session from the garbage collection?
4. is something wrong with my code?
regards