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

Suggested Topics

Abdulhalim
started Loading CSS in Localhost
General Questions

shoaiyb@b4cd1e7b
started theme Where do I find themes? Or, how do I create one?
General Questions

123456789abc01
started Documentation terrible for noobs ...
Open Bar

YoheiSato@1f59749d
started solved Simple typo to be fixed
Bug reports