From 00fe04a82fa439b755def52773e5052b5b9c7509 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 13 Oct 2023 19:31:41 +0200 Subject: [PATCH] number of user session can be limited --- inc/inc.ClassSession.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inc/inc.ClassSession.php b/inc/inc.ClassSession.php index 78f796a0b..a9940d938 100644 --- a/inc/inc.ClassSession.php +++ b/inc/inc.ClassSession.php @@ -473,8 +473,11 @@ class SeedDMS_SessionMgr { * * @return array list of sessions */ - function getUserSessions($user) { /* {{{ */ + function getUserSessions($user, $limit=0) { /* {{{ */ $queryStr = "SELECT * FROM `tblSessions` WHERE `userID`=".$user->getID(); + $queryStr .= " ORDER BY `lastAccess` DESC"; + if($limit > 0) + $queryStr .= " LIMIT ".(int) $limit; $resArr = $this->db->getResultArray($queryStr); if (is_bool($resArr) && $resArr == false) return false;