I\'m doing a database project for university and I\'m strugling with a problem in here. I\'m trying to show \"log in\" when there\'s no session and \"log out\" when there is
when your login is success on login page.
session_start();
$_SESSION['user_logged_in'] = true;
in your logout page
session_start();
unset($_SESSION['user_logged_in']);
session_destroy();
in your home page
<?php
session_start();
if(isset($_SESSION['user_logged_in'])) {
?>
< a href='logout.php'>Logout</a>
<?php
}
else {
?>
< a href='login.php'>Login</a>
<?php
}
?>