Increasing the Admin timeout in Zen Cart 1.5.0

*** Warning: This change will violate the PCI status of your cart.  You should only do this on test carts on your own PC or on carts which do not require PCI certification. ***

To increase the Admin Timeout value to 1800 seconds (30 minutes), go to Admin->Tools->Install SQL patches, and paste the following into the “Enter the query to be executed” box:

UPDATE configuration SET
configuration_value = '1800',
set_function = 'zen_cfg_select_option(array(\'1800\', \'900\', \'600\', \'300\'), '
WHERE configuration_key = 'SESSION_TIMEOUT_ADMIN';

To change it back, go to  Admin->Configuration->My Store, and set the
Admin Session Time Out in Seconds value back to 900.

To use a value other than 30 minutes, just change the two “1800” numbers above to a number of seconds of your choosing (above 900).

Then modify /includes/functions/sessions.php as follows:

a) Find the block that looks like this:

if (!$SESS_LIFE = (SESSION_TIMEOUT_ADMIN > 900 ? 900 : SESSION_TIMEOUT_ADMIN)) {
$SESS_LIFE = (SESSION_TIMEOUT_ADMIN > 900 ? 900 : SESSION_TIMEOUT_ADMIN);
}

and change it to this:

$SESS_LIFE = SESSION_TIMEOUT_ADMIN;

b) Find the block that looks like this:

      
@ini_set('session.gc_maxlifetime', (SESSION_TIMEOUT_ADMIN > 900 ? 900 : SESSION_TIMEOUT_ADMIN));

and change it to this:

      
@ini_set('session.gc_maxlifetime', SESSION_TIMEOUT_ADMIN);

11 thoughts on “Increasing the Admin timeout in Zen Cart 1.5.0”

  1. Change just the bottom line of code in the first block so it looks like this and your admin will not disappear

    if (!$SESS_LIFE = (SESSION_TIMEOUT_ADMIN > 900 ? 900 : SESSION_TIMEOUT_ADMIN)) {
    $SESS_LIFE = SESSION_TIMEOUT_ADMIN;
    }

  2. This doesn’t seem to work for me. It does add the option to admin but when it’s selected it still times out the admin session long before the allocated amount of seconds.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.