View Single Post
  #1 (permalink)  
Old 06-17-2008, 07:23 AM
mbhramar mbhramar is offline
Junior Member
 
Join Date: Jun 2008
Posts: 1
Default weird session timeout for user inactivity

Hi,
What I want to do is very general & simple. I am sure I am missing something.

I am authenticating & a suer & setting session in the following way :
PHP Code:
$authAdapter = new Zend_Auth_Adapter_DbTable($db);

    
$authAdapter->setTableName('users');

    
$authAdapter->setIdentityColumn('username');

    
$authAdapter->setCredentialColumn('password');

    
// Set the input credential values to authenticate against

    
$authAdapter->setIdentity($username);

    
$authAdapter->setCredential($password);

    
// do the authentication

    
$auth Zend_Auth::getInstance();

    
$result $auth->authenticate($authAdapter);

    if (
$result->isValid()) {

    
// success: store database row to auth's storage

    // system. (Not the password though!)

    
$data $authAdapter->getResultRowObject(null,

    
'password');

    
$auth->getStorage()->write($data);

        
$fullName Zend_Auth::getInstance()->getIdentity();

   

    
// Set session expiry

    
$authNamespace = new Zend_Session_Namespace('Zend_Auth');

    
$authNamespace->user $username;

    
$authNamespace->setExpirationSeconds(1200); 

Now what happens is that the user is authenticated & session is set but the session expires after 20 mins regardless of whether there was any inactivity or the user was actively working on the application.

What I need is that the session should expire only if there is an inactivity of 20mins, not just time lapse of 20 min. But as of now, even when I am actively clicking away on the app, I get logged out.
Please help. Also pls suggest any better way to do the above. I am sure I am not using the best methods available in this pool of ZF.

Thanks.
Mayank
Reply With Quote