number of user session can be limited

This commit is contained in:
Uwe Steinmann 2023-10-13 19:31:41 +02:00
parent 183bdcfa69
commit 00fe04a82f

View File

@ -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;