Latest News: (loading..)

Archived

This topic is now archived and is closed to further replies.

isumitg

Increase session timeout

5 posts in this topic

Whenever a user is logged into my website, he is automatically signed out after a fixed amount of time. How can I modify this time?

 

1. I want user to be logged out only when he clicks on "Logout" button. The time when he click the logout button might be 2 weeks, 1 month or longer.

 

2. I want user to keep logged in even if he closes the web-browser and reopens it. How can I do this?

 

Please help. Thanks.

Share this post


Link to post
Share on other sites

@@isumitg

 

Look for this code in the /includes/functions/sessions.php file

 

 

if (STORE_SESSIONS == 'mysql') {

if (!$SESS_LIFE = get_cfg_var('session.gc_maxlifetime')) {

$SESS_LIFE = 1440;

}

 

Change the 1440 to whatever you want.....

 

 

 

Chris

 

 

ps. Closing the browser will end the session

Share this post


Link to post
Share on other sites

Thanks Chris @@DunWeb

 

I changed as you suggested but it is not working. Any idea why?

 

I have changed it to the following

 

if (!$SESS_LIFE = get_cfg_var('session.gc_maxlifetime')) {
  $SESS_LIFE = 864000; //10 days
}

 

Below are my settings in Admin panel:

 

Session Directory: <...>/public_html/catalog/includes/work/

Force Cookie Use: False

Check SSL Session ID: False

Check User Agent: False

Check IP Address: False

Prevent Spider Sessions: True

Recreate Session:True

Share this post


Link to post
Share on other sites

Well, one obvious reason for that failing is if the default PHP session.gc_maxlifetime value is defined and is set to something other than zero (which will often be the case). The inner code will not be executed at all, and it doesn't matter what value you set it to.

 

So I suggest replacing these three lines of code:

if (!$SESS_LIFE = get_cfg_var('session.gc_maxlifetime')) {
$SESS_LIFE = 1440;
}

with just the one line:

$SESS_LIFE = 864000; //10 days

Share this post


Link to post
Share on other sites