sessionLogin(); } catch (Exception $e) { echo $e->getMessage(); die(); } if ($login) { if ($_SESSION["user_role"] === "superadmin") { header('Location: /admin.php'); } else { header('Location: /'); } } else if ($account->isAuthenticated()) { if ($_SESSION["user_role"] === "superadmin") { header('Location: /admin.php'); } else { header('Location: /'); } } else { header('Location: /login.php'); } ?>