Implements the session class

main
Yasen Pramatarov 2025-04-13 19:46:48 +03:00
parent f77e15bf44
commit 522cded113
3 changed files with 5 additions and 5 deletions

View File

@ -9,9 +9,9 @@ if (!($userObject->hasRight($user_id, 'superuser') ||
exit;
}
if (!isset($currentUser)) {
include '../app/templates/error-unauthorized.php';
exit;
if (!Session::getUsername()) {
header('Location: ' . htmlspecialchars($app_root) . '?page=login');
exit();
}
// Get current section

View File

@ -12,7 +12,7 @@
</div>
<?php if (isset($currentUser) && $page !== 'logout') { ?>
<?php if (Session::getUsername() && $page !== 'logout') { ?>
<script src="static/js/sidebar.js"></script>
<?php } ?>

View File

@ -10,7 +10,7 @@
<link rel="stylesheet" type="text/css" href="<?= htmlspecialchars($app_root) ?>static/css/main.css">
<link rel="stylesheet" type="text/css" href="<?= htmlspecialchars($app_root) ?>static/css/messages.css">
<script src="<?= htmlspecialchars($app_root) ?>static/js/messages.js"></script>
<?php if (isset($currentUser)) { ?>
<?php if (Session::getUsername()) { ?>
<script>
// restore sidebar state before the page is rendered
(function () {