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
Share on other sites

Your log out link goes to logout.php, but you've only shown us the code for index.php. The problem would be in the logout.php script (as that's where the browser is going once the link is clicked), so show us that code as well.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.