1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 13:30:25 +02:00

[ticket/16470] Further do not rely on session_time displaying user activity

session_time has not been updated during session_length, so relying on it last
activity data will be incorrect, especially if session_length value is high.
Thus rely on regular and properly updated user_lastvisit.
Remove user_lastvisit vs with session_time sync for the same reason.
Also get rid of the session_last_visit field as it floats between
user_lastvisit and session_time and actually is meaningless.

PHPBB3-16470
PHPBB3-14173
This commit is contained in:
rxu
2023-06-22 13:02:43 +07:00
parent 735b826063
commit 33dfaa478c
6 changed files with 30 additions and 111 deletions

View File

@@ -3816,7 +3816,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
}
// Last visit date/time
$s_last_visit = ($user->data['user_id'] != ANONYMOUS) ? $user->format_date($user->data['session_last_visit']) : '';
$s_last_visit = ($user->data['user_id'] != ANONYMOUS) ? $user->format_date($user->data['user_lastvisit']) : '';
// Get users online list ... if required
$l_online_users = $online_userlist = $l_online_record = $l_online_time = '';
@@ -3854,10 +3854,10 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
{
if ($user->data['user_new_privmsg'])
{
if (!$user->data['user_last_privmsg'] || $user->data['user_last_privmsg'] > $user->data['session_last_visit'])
if (!$user->data['user_last_privmsg'] || $user->data['user_last_privmsg'] > $user->data['user_lastvisit'])
{
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_last_privmsg = ' . $user->data['session_last_visit'] . '
SET user_last_privmsg = ' . $user->data['user_lastvisit'] . '
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);