Fixes login issues

main
Yasen Pramatarov 2024-07-03 18:15:32 +03:00
parent cb26576eeb
commit 15320854f3
2 changed files with 3 additions and 3 deletions

View File

@ -49,7 +49,7 @@ if (isset($_COOKIE['username'])) {
} }
// redirect to login // redirect to login
if ( !isset($_SESSION['user_id']) && ($page !== 'login' && $page !== 'register') ) { if ( !isset($_COOKIE['username']) && ($page !== 'login' && $page !== 'register') ) {
header('Location: index.php?page=login'); header('Location: index.php?page=login');
exit(); exit();
} }

View File

@ -2,13 +2,13 @@
<div class="menu-container"> <div class="menu-container">
<ul class="menu-left"> <ul class="menu-left">
<li><a href="index.php">home</a></li> <li><a href="index.php">home</a></li>
<?php if ( isset($_SESSION['user_id']) ) { ?> <?php if ( isset($_SESSION['username']) ) { ?>
<li><a href="?page=config">config</a></li> <li><a href="?page=config">config</a></li>
<?php } ?> <?php } ?>
</ul> </ul>
<ul class="menu-right"> <ul class="menu-right">
<?php if ( isset($_SESSION['user_id']) ) { ?> <?php if ( isset($_SESSION['username']) ) { ?>
<li><a href="?page=profile"><?= $user ?></a></li> <li><a href="?page=profile"><?= $user ?></a></li>
<li><a href="?page=logout">logout</a></li> <li><a href="?page=logout">logout</a></li>
<?php } else { ?> <?php } else { ?>