I am very new to PHP and HTML, so I don't understand enough to see what's going wrong. I've got my own web server set up, and am in the middle of creating user accounts for the website on it. I've done the whole accounts system, I'm just struggling with showing a 'Log out' button if the user is logged in, and a 'Log in' button if the user is not. I have created a session upon logging in, but when I use the php if statement, both the IF and the ELSE statements run, creating both buttons. Any ideas?
PHP Header:
<?php
session_start();
?>
PHP If Statement:
<ul>
<?php if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true) : ?>
<li><a href="/login.php">Log In</a></li>
<?php else : ?>
<li><a href="/logout.php">Log Out</a></li>
<?php endif; ?>
</ul>
Aucun commentaire:
Enregistrer un commentaire