I have this at the top of all my protected pages
Code: Select all
session_start(); // Start/Resume session
if ( !$_SESSION['auth'] ) {
header("Location: /index.php");
}Sessions timeout out after a certain perios of time set in the php.ini. What i want to do is detect if the session has timed out, so if it has, when the user is redirected back to the login page, they are also presented with a message along the lines of "For security reasons, you were automatically logged out".
Is this possible?
I am guessing i can't detect if the session has expired directly, but i could start a timer to detect the length of inactivity!?
Some pseudo code or point me in the direction fo the function i may need will do.
Thanks
Mark