Line 441 | Line 441 |
---|
$this->check_ban_for_current_session($config);
// Update user last active time accordingly, but in a minute or so
|
$this->check_ban_for_current_session($config);
// Update user last active time accordingly, but in a minute or so
|
if ((int) $this->data['session_time'] - (int) $this->data['user_last_active'] > 60)
| if ($this->time_now - (int) $this->data['user_last_active'] > 60)
|
{ $this->update_last_active_time(); }
| { $this->update_last_active_time(); }
|
Line 819 | Line 819 |
---|
// Update the form key $sql = 'UPDATE ' . USERS_TABLE . ' SET user_form_salt = \'' . $db->sql_escape($this->data['user_form_salt']) . '\',
|
// Update the form key $sql = 'UPDATE ' . USERS_TABLE . ' SET user_form_salt = \'' . $db->sql_escape($this->data['user_form_salt']) . '\',
|
user_last_active = ' . (int) $this->data['session_time'] . '
| user_last_active = ' . (int) $this->time_now . '
|
WHERE user_id = ' . (int) $this->data['user_id']; $db->sql_query($sql); }
| WHERE user_id = ' . (int) $this->data['user_id']; $db->sql_query($sql); }
|
Line 964 | Line 964 |
---|
}
/**
|
}
/**
|
* Get most recent session for each registered user to sync user last visit with it * Inner SELECT gets most recent sessions for each unique session_user_id
| * Get expired sessions for registered users, only most recent for each user * Inner SELECT gets most recent expired sessions for unique session_user_id
|
* Outer SELECT gets data for them */ $sql_select = 'SELECT s1.session_page, s1.session_user_id, s1.session_time AS recent_time
| * Outer SELECT gets data for them */ $sql_select = 'SELECT s1.session_page, s1.session_user_id, s1.session_time AS recent_time
|
Line 973 | Line 973 |
---|
INNER JOIN ( SELECT session_user_id, MAX(session_time) AS recent_time FROM ' . SESSIONS_TABLE . '
|
INNER JOIN ( SELECT session_user_id, MAX(session_time) AS recent_time FROM ' . SESSIONS_TABLE . '
|
WHERE session_user_id <> ' . ANONYMOUS . '
| WHERE session_time < ' . ($this->time_now - (int) $config['session_length']) . ' AND session_user_id <> ' . ANONYMOUS . '
|
GROUP BY session_user_id ) AS s2 ON s1.session_user_id = s2.session_user_id
| GROUP BY session_user_id ) AS s2 ON s1.session_user_id = s2.session_user_id
|
Line 1812 | Line 1813 |
---|
{ $sql = 'UPDATE ' . USERS_TABLE . ' SET user_lastvisit = ' . (int) $this->data['session_time'] . ',
|
{ $sql = 'UPDATE ' . USERS_TABLE . ' SET user_lastvisit = ' . (int) $this->data['session_time'] . ',
|
user_last_active = ' . (int) $this->data['session_time'] . '
| user_last_active = ' . $this->time_now . '
|
WHERE user_id = ' . (int) $this->data['user_id']; $db->sql_query($sql); }
| WHERE user_id = ' . (int) $this->data['user_id']; $db->sql_query($sql); }
|
Line 1827 | Line 1828 |
---|
{ global $db;
|
{ global $db;
|
if (isset($this->data['session_time'], $this->data['user_id']))
| if (isset($this->time_now, $this->data['user_id']))
|
{ $sql = 'UPDATE ' . USERS_TABLE . '
|
{ $sql = 'UPDATE ' . USERS_TABLE . '
|
SET user_last_active = ' . (int) $this->data['session_time'] . '
| SET user_last_active = ' . $this->time_now . '
|
WHERE user_id = ' . (int) $this->data['user_id']; $db->sql_query($sql); }
| WHERE user_id = ' . (int) $this->data['user_id']; $db->sql_query($sql); }
|