From 1e8329986ef4d06a9bb7550e24f4dacc7715fb5b Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 4 May 2021 17:32:26 +0200 Subject: [main+Session] Move session from /tmp/ to session table --- inc/user.inc.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'inc/user.inc.php') diff --git a/inc/user.inc.php b/inc/user.inc.php index 2ad256af..46cc6012 100644 --- a/inc/user.inc.php +++ b/inc/user.inc.php @@ -113,8 +113,8 @@ class User if (self::isLoggedIn()) return true; if (Session::load()) { - $uid = Session::get('uid'); - if ($uid === false || $uid < 1) + $uid = Session::getUserId(); + if ($uid < 1) self::logout(); self::$user = Database::queryFirst('SELECT * FROM user WHERE userid = :uid LIMIT 1', array(':uid' => $uid)); if (self::$user === false) @@ -149,8 +149,7 @@ class User return false; if (!Crypto::verify($pass, $ret['passwd'])) return false; - Session::create($ret['passwd']); - Session::set('uid', $ret['userid']); + Session::create($ret['passwd'], $ret['userid'], false); Session::set('token', md5($ret['passwd'] . ',' . rand() . ',' . time() . ',' @@ -159,8 +158,7 @@ class User . rand() . ',' . $_SERVER['REMOTE_PORT'] . ',' . rand() . ',' - . $_SERVER['HTTP_USER_AGENT'])); - Session::save(); + . $_SERVER['HTTP_USER_AGENT']), false); return true; } -- cgit v1.2.3-55-g7522