Is there a way in Zend Framework or PHP to get the time until the Session(PHPSESSID cookie) expires?
Asked
Active
Viewed 1.1k times
10
-
which type of authentication are you using in Zend Framework? – Raj Feb 28 '11 at 19:17
-
session cookies never expire thats why they are called session cookies (without any time stamp) !! – Mr Coder Feb 28 '11 at 19:29
1 Answers
16
I don't know of any method provided by the framework to achieve this. But as soon as you know where ZF stores expiration time for its namespaces, you might be able to do something like this:
$session = new Zend_Session_Namespace( 'Zend_Auth' );
$session->setExpirationSeconds( 60 );
$timeLeftTillSessionExpires = $_SESSION['__ZF']['Zend_Auth']['ENT'] - time();

Vika
- 3,275
- 18
- 16
-
Well i guess it should be `$_SESSION['__ZF']['Zend_Auth']['ENVT'] - time();` But still, thanks for your help!! Wouldn't have made it without your ;) – fsteinbauer Mar 06 '11 at 21:22