/** * Update attributes * * @param AbstractUser $user */ protected function updateAttributes(AbstractUser $user) { $user->offsetSet('ip', $this->network->getClientIp()); $user->offsetSet('userAgent', $this->network->getUserAgent()); if ($user->offsetGet('lastVisit') < time() - 90) { $user->offsetSet('lastVisit', time()); } }
/** * Insert new session record * * @param \PDOStatement $stmt * @param string $sessionId * @return string * @throws \HttpRuntimeException */ private function insertRecord(\PDOStatement $stmt, $sessionId) { try { $insertStmt = $this->db->prepare('INSERT INTO `sys__sessions` (`id`, `data`, `timestamp`, `ip`, `userAgent`, `place`, `views`, `movings`) VALUES (:id, :data, :time, :ip, :ua, :place, 1, 1)'); $insertStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); $insertStmt->bindValue(':data', '', \PDO::PARAM_LOB); $insertStmt->bindValue(':time', time(), \PDO::PARAM_INT); $insertStmt->bindValue(':ip', $this->network->getClientIp(), \PDO::PARAM_STR); $insertStmt->bindValue(':ua', $this->network->getUserAgent(), \PDO::PARAM_STR); $insertStmt->bindValue(':place', '', \PDO::PARAM_STR); $insertStmt->execute(); } catch (\PDOException $e) { $this->catchDuplicateKeyError($e, $stmt); } return ''; }