Re: [PHP] Making a Timeout Expiration Length to Session Variables
[email protected] (Karim Geiger)
| Newsgroups | php.general |
|---|---|
| Message-ID | <[email protected]> |
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
signature.asc
(application/pgp-signature, 555 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJR2mx1AAoJEP3U0UyBvgwD3IcIAM7AVw0aPn0o7/2vvmc/CBrg Pq4giE1L/D7bFNGxed5E5i8SgctxbTzmsMsK86Q9R0GYweiHxwLsv9/3OH7sQDcf +DUdXuajQ3dNbSYCRAC2uuWCNbFeA5zEDOPbz9KnvwGKFszSDi6g6W8JRayT+XOH gYht+9br0v6Vf6XFmo6ZKQnDv7H5qNTB84ZX3APSX/zjW+MJPwup0QfscGZtaZVi C8Uby4yL/qUxEsgQ6DolxoPvst/wp+F/v18Onnw3t8A2Xv4S8ujASZ5pNTBgNzAD NfGOIH8bSW3y3/FmeVXYC6/pctTd4LV5qWFIXXvVfoFTXYk2oAFvEwLZLmSEvmM= =Y7hb -----END PGP SIGNATURE-----