Extend Session Logout Time
Extend Session Logout Time
Ben@84171e7c Monday 24th July 2023, 16:58:55If you find yourself needing to login in too frequently, here's how to extend this.
To change the session timeout to a longer period of time (e.g., 2 hours) before automatically logging out, you need to set the session.gc_maxlifetime value using the ini_set() function.
Before you start, first make a backup of the header.php file.
Then you can modify the header.php file as shown:
Open the header.php file in the root folder of your Flatboard install with a text or code editor.
Locate the section where session_start() is called. It looks like this:
Then you need to add the following code above the session_start() function line to set the session timeout to 2 hours:
Save your changes and now forum users will stay logged in for 2 hours of inactivity before being automatically logged out.
The 120 session timeout can be changed to fit your preference. Multiply the number of hours you want your session to last by 60 and replace 120 with this number. Don't set it for too long as this can pose a security risk.
To change the session timeout to a longer period of time (e.g., 2 hours) before automatically logging out, you need to set the session.gc_maxlifetime value using the ini_set() function.
Before you start, first make a backup of the header.php file.
Then you can modify the header.php file as shown:
Open the header.php file in the root folder of your Flatboard install with a text or code editor.
Locate the section where session_start() is called. It looks like this:
if (!session_id()) session_start();
$token = CSRF::generate();
Then you need to add the following code above the session_start() function line to set the session timeout to 2 hours:
// Set the session timeout to 2 hours (120 seconds)
$sessionTimeoutSeconds = 120;
// Set the session.gc_maxlifetime configuration option using ini_set()
ini_set('session.gc_maxlifetime', $sessionTimeoutSeconds);
Save your changes and now forum users will stay logged in for 2 hours of inactivity before being automatically logged out.
The 120 session timeout can be changed to fit your preference. Multiply the number of hours you want your session to last by 60 and replace 120 with this number. Don't set it for too long as this can pose a security risk.
Reply 1
That would be great, but certain server hosting disallows ini_set functions.
Software engineer, creates plugins for Flatboard, checks source codes, and answers any software errors questions and contributes on the GitHub page as well
Suggested Topics
Fred
started plugin Maintenance mode
Resources
hello#67a44
started markdown
General Questions
jacK@bff71521
started Problem @mail ?
Feature Requests