My question relates to the records in the zzzzsys_session table. I have noticed that session records are removed if the logout link is used. However, if the user closes the tab/browser or the session times out, the record is not removed. Is there any way of knowing which of the sessions in this table are active? (By 'active', I mean the elapsed time since the last activity is less than the timeout setting. )
I was able to implement a rather simplistic way of storing the date and time of the most recent activity of a session but it required some changes to the table structure and one of the PHP files - something I would rather not do as it would require these edits every time the nuBuilder files are updated. Here is what I did.
Step 1: Modify the session table thus: ALTER TABLE `zzzzsys_session` ADD `sss_last_activity` DATETIME
Step 2: Add one new line of code to nusession.php (around line 218)
Code: Select all
if((($r->set_time_out_minutes * 60) + $_SESSION['SESSION_TIMESTAMP']) >= time()){
$_SESSION['SESSION_TIMESTAMP'] = time();
// one new line below - update the last activity time
nuRunQuery("UPDATE zzzzsys_session SET sss_last_activity = NOW() WHERE zzzzsys_session_id = ?", array($_SESSION['SESSION_ID']));
}else{
$_SESSION['SESSION_ID'] = null;
This works OK but I would prefer to use a method that does not require modifications to the nuBuilder files. Is there a better way of doing this?
Thanks.
Neil