FoOlSlideX/session.php

16 lines
486 B
PHP
Raw Permalink Normal View History

2023-03-30 23:00:50 +02:00
<?php
$logged = false;
$user = array();
if (isset($_COOKIE[cat($config["title"]) . "_session"]) && !empty($_COOKIE[cat($config["title"]) . "_session"])) {
$token = clean($_COOKIE[cat($config["title"]) . "_session"]);
$session = $db["sessions"]->findOneBy(["token", "=", $token]);
if (!empty($session)) {
unset($user);
$user = $db["users"]->findOneBy(["id", "=", $session["user"]]);
if (!empty($user)) {
$logged = true;
}
}
}