Jump to content

[SOLVED] Logout Error


Recommended Posts

I have a login system and when I logout, I am still logged in!


I do not know why.


Here is the script that keeps user's from viewing unless they are logged in!

$username = $_COOKIE['loggedin'];
if (!isset($_COOKIE['loggedin'])) die("You are not logged in, <a href=login.php>click here</a> to login.");
echo "<u>Welcome <b>$username</b></u>";



Here is the logout script


setcookie("loggedin",time()-(3600 * 24));


How am I able to fix this?


-Thanks Lamez.

Link to comment
Share on other sites

well if you have a timeout on your cookie ( when you set it...... ) then simply reset the timout time, to 5 minutes before its set......... so that its automatically deleted on the page refresh..... you could even automatically relocate to eg index.php?message=logut  then on index.php, add a popup to say "you are logged out" , if $_GET['message'] == "logout" etc.




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.

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.