Re: session timeout
| From: | afan at afan dot net | Date: | Mon, 04 Oct 2004 15:20:07 +0000 |
| Subject: | Re: session timeout | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-198591@lists.php.net to get a copy of this message | ||
# store entry time to session
$_SESSION['entry_time'] = time();
# checking if session expired
if((time() - $_SESSION['entry_time']) > 3600) #session expired after 1 hour
{
header('login.php');
exit;
}
-afan
> Hi all.
>
> I have users log into my site to perform certain actions. However, I
> want to create a timed session so that it automatically logs them out
> after a certain amount of time. I am using
>
session_set_cookie_params() to create the amount of available
> time
> that the user is logged in.
>
> But my question is: how do I test to see if the session has timed out?
> Once the session time has elapsed, are the $_SESSION variables
> automatically destroyed or what?
>
> Thanks in advance,
> ~Philip
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>