diff options
author | msquare <msquare@notrademark.de> | 2017-07-28 20:11:09 +0200 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2017-07-28 20:11:09 +0200 |
commit | f82e5456d22af7e39a22a9a64e74072cf01e0a31 (patch) | |
tree | c024194bd11621e1956a659a0ec91ee7c747b40c /includes/sys_auth.php | |
parent | 69a1ee2bfefb43a802dea8cf0f833cbe0a00369c (diff) |
dried code by introducing selectOne for select queries with only one result line expected
Diffstat (limited to 'includes/sys_auth.php')
-rw-r--r-- | includes/sys_auth.php | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/includes/sys_auth.php b/includes/sys_auth.php index f1ec3192..e0ed67e5 100644 --- a/includes/sys_auth.php +++ b/includes/sys_auth.php @@ -11,10 +11,9 @@ function load_auth() $user = null; if (isset($_SESSION['uid'])) { - $user = DB::select('SELECT * FROM `User` WHERE `UID`=? LIMIT 1', [$_SESSION['uid']]); - if (count($user) > 0) { + $user = DB::selectOne('SELECT * FROM `User` WHERE `UID`=? LIMIT 1', [$_SESSION['uid']]); + if (!empty($user)) { // User ist eingeloggt, Datensatz zur Verfügung stellen und Timestamp updaten - $user = array_shift($user); DB::update(' UPDATE `User` SET `lastLogIn` = ? |