feat: improve session loading
This commit is contained in:
parent
5295cbc7e1
commit
b36621d767
1 changed files with 8 additions and 6 deletions
|
@ -261,7 +261,7 @@ class User
|
||||||
);
|
);
|
||||||
$database->connect();
|
$database->connect();
|
||||||
|
|
||||||
$session = $database
|
$sessions = $database
|
||||||
->query(
|
->query(
|
||||||
'SELECT *
|
'SELECT *
|
||||||
FROM `sessions`
|
FROM `sessions`
|
||||||
|
@ -270,17 +270,19 @@ class User
|
||||||
'session' => $_COOKIE['wishthis_session'],
|
'session' => $_COOKIE['wishthis_session'],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->fetch();
|
->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
if (false === $session) {
|
if (false === $sessions) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\strtotime($session['expires']) <= \time()) {
|
foreach ($sessions as $session) {
|
||||||
return false;
|
if (\strtotime($session['expires']) > \time()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue