Changeset 780 for trunk


Ignore:
Timestamp:
Jan 26, 2023 5:18:34 PM (16 months ago)
Author:
anonymous
Message:

Avoid error if last_access_datetime is older than 1970

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Auth_SQL.inc.php

    r775 r780  
    344344            $db->query(sprintf(
    345345                "UPDATE %s SET
    346                     seconds_online = seconds_online + ABS(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(last_access_datetime)),
     346                    seconds_online = seconds_online + IFNULL(ABS(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(last_access_datetime)), 0),
    347347                    last_login_datetime = '%s 00:00:00'
    348348                    WHERE %s = '%s'
     
    700700            $db->query("
    701701                UPDATE " . $this->_params['db_table'] . " SET
    702                 seconds_online = seconds_online + ABS(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(last_access_datetime)) + 1,
     702                seconds_online = seconds_online + IFNULL(ABS(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(last_access_datetime)), 0) + 1,
    703703                last_access_datetime = '" . $this->get('last_access_datetime') . "'
    704704                WHERE " . $this->_params['db_primary_key'] . " = '" . $this->get('user_id') . "'
Note: See TracChangeset for help on using the changeset viewer.