Re: Making a Timeout Expiration Length to Session Variables
| From: | Karim Geiger | Date: | Mon, 08 Jul 2013 07:38:26 +0000 |
| Subject: | Re: Making a Timeout Expiration Length to Session Variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-321584@lists.php.net to get a copy of this message | ||
Hi,
On 07/08/2013 05:10 AM, dealTek wrote:
> Hi all,
>
> I would like to make a timeout length to session variables, so that if a user didn't use
> the browser page for let's say 5 minutes - the session variables would expire and the user
> would need to login again.
>
>
> Q: What's the best way to implement this functionality?
You can either use cookies or do something like that:
http://stackoverflow.com/questions/3068744/php-session-timeout
In your case is would be
if ($_SESSION['timeout'] + 5 * 60 < time()) {
// session timed out
} else {
// session ok
}
Karim
--
Karim Geiger
Auszubildender Fachinformatiker AE
B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc