From 7878fbc8783ce1b636bb5b5f78fef9742e4aff37 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 12 Jun 2021 11:57:10 -0400 Subject: [PATCH] Add a limit of 1000 when pulling sessions. Sessions table can contain hundreds of thousands of lines all relatively useless. Modals need to pop up fast. --- web/ajax/modals/logout.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/web/ajax/modals/logout.php b/web/ajax/modals/logout.php index a0648a70c..e9066795d 100644 --- a/web/ajax/modals/logout.php +++ b/web/ajax/modals/logout.php @@ -43,8 +43,8 @@ global $CLANG; fetch(PDO::FETCH_ASSOC) ) { $_SESSION = array(); - if ( ! session_decode($row['data']) ) { - ZM\Warning('Failed to decode ' . $row['data']); + if (!session_decode($row['data'])) { + ZM\Warning('Failed to decode '.$row['data']); continue; } - ZM\Debug(print_r($_SESSION, true)); - if ( isset($_SESSION['last_time']) ) { + if (isset($_SESSION['last_time'])) { # This is a dead session continue; } - if ( !isset($_SESSION['username']) ) { + if (!isset($_SESSION['username'])) { # Not logged in continue; } - if ( isset($user_cache[$_SESSION['username']]) ) { + if (isset($user_cache[$_SESSION['username']])) { $user = $user_cache[$_SESSION['username']]; } else { $user = ZM\User::find_one(array('Username'=>$_SESSION['username'])); - if ( ! $user ) { - ZM\Debug('User not found for ' . $_SESSION['username']); + if (!$user) { + ZM\Debug('User not found for '.$_SESSION['username']); continue; } $user_cache[$_SESSION['username']] = $user;