Zen Cart Logo
Forums / Bug Reports / [Done - post139] Admin Session Timeout setting ineffective with file based sessions

[Done - post139] Admin Session Timeout setting ineffective with file based sessions

Locked

Views: 1,297

Results 1 to 1 of 1
This thread is locked. New replies are disabled.
28 Jun 2010, 9:58 PM
#1
cjpinder avatar

cjpinder

Totally Zenned

Join Date:
Apr 2007
Location:
Herts. UK
Posts:
893
Plugin Contributions:
0

[Done - post139] Admin Session Timeout setting ineffective with file based sessions

Hi,

In Zen Cart v1.3.x, if you are using file based sessions (as opposed to database ones) then the My Store > 'Admin Session Time Out in Seconds' setting is ineffective.

This is because the Admin sessions are stored in the same directory as the store front sessions. When the store front sessions are cleaned up the admin sessions are also timed out at the same time.

My solution is to store the Admin sessions in a different directory.

First create a sub-directory called 'admin' in the 'cache' directory. Set the appropriate file ownership and permissions so the web server can write to the sub-directory.

Next, edit /includes/functions/sessions.php and change the zen_session_save_path() function to...

  function zen_session_save_path($path = '') {
    if (!empty($path)) {
      if (defined('DIR_WS_ADMIN'))
        return session_save_path($path . '/admin');
      else
        return session_save_path($path);
    } else {
      return session_save_path();
    }
  }
```The Admin sessions will then be saved in the 'admin' sub-directory and will not be timed out with the store front sessions.

Regards,
Christian.