i am watching a youtube tutorial for a register and login page the register and login parts work fine but once the user is logged in the logout button will not work it won't delete the session but if i delete the session using the inspect element of my browser and refresh the page the user will be logged out but the button will not work. here is the youtube part I'm up to.
would like to continue with these parts once this problem is fixed I've tried a few debugging methods that you will see in my code witch there is a lot of but i think its all worth showing because the functions go across different files.
index.php
<?php
require_once 'core/init.php';
if(Session::exists('home')) {
'<p>' . Session::flash('home') . '</p>';
}
$user = new User();
if($user->isLoggedIn()) {
?>
<p>Hello <a href="#"><?php echo escape($user->data()->username); ?> </a></p>
<ul>
<li><a href="logout.php">Log out</a></li>
</ul>
<?php
} else {
echo '<p>You need to <a href="login.php">Log In</a> or <a href="register.php">Register</a></p>';
}