fix: loading existing session

This commit is contained in:
grandeljay 2023-12-18 11:59:11 +01:00
parent fcd6378fef
commit 229d04eb07

View file

@ -644,7 +644,7 @@ class User
public function loadFromSession(): void public function loadFromSession(): void
{ {
if (!$this->isLoggedIn()) { if (!isset($_COOKIE['wishthis_session'])) {
return; return;
} }
@ -660,11 +660,9 @@ class User
->query( ->query(
'SELECT * 'SELECT *
FROM `sessions` FROM `sessions`
WHERE `session` = :session WHERE `session` = :session',
AND `user` = :user',
array( array(
'session' => $_COOKIE['wishthis'], 'session' => $_COOKIE['wishthis_session'],
'user' => $this->id,
) )
) )
->fetch(\PDO::FETCH_ASSOC); ->fetch(\PDO::FETCH_ASSOC);
@ -679,7 +677,7 @@ class User
FROM `users` FROM `users`
WHERE `id` = :user', WHERE `id` = :user',
array( array(
'user' => $this->id, 'user' => $session['user'],
) )
) )
->fetch(\PDO::FETCH_ASSOC); ->fetch(\PDO::FETCH_ASSOC);