Jump to content

Object Orientated Logout Button Problem


CripDawg

Recommended Posts

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>';
}
Link to comment
https://forums.phpfreaks.com/topic/295469-object-orientated-logout-button-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.