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; exit;
} }
if (!isset($currentUser)) { if (!Session::getUsername()) {
include '../app/templates/error-unauthorized.php'; header('Location: ' . htmlspecialchars($app_root) . '?page=login');
exit; exit();
} }
// Get current section // Get current section

View File

@ -12,7 +12,7 @@
</div> </div>
<?php if (isset($currentUser) && $page !== 'logout') { ?> <?php if (Session::getUsername() && $page !== 'logout') { ?>
<script src="static/js/sidebar.js"></script> <script src="static/js/sidebar.js"></script>
<?php } ?> <?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/main.css">
<link rel="stylesheet" type="text/css" href="<?= htmlspecialchars($app_root) ?>static/css/messages.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> <script src="<?= htmlspecialchars($app_root) ?>static/js/messages.js"></script>
<?php if (isset($currentUser)) { ?> <?php if (Session::getUsername()) { ?>
<script> <script>
// restore sidebar state before the page is rendered // restore sidebar state before the page is rendered
(function () { (function () {