Jump to content

logout problem


182x

Recommended Posts

Hey guys,

 

Sorry for another newbie question but I have used the following code for a logout page but when I click the logout button the session variables are still on scope.

 

I was just wondering what I did wrong?

 

<?php
session_start();
session_destroy();
header("location:index.php")
?>


Link to comment
Share on other sites

You need to unset the session cookie

 

www.php.net/session_destroy

 

see the examples/user comments about that.

 

Remember if you have the domain/path set for the cookie you need to add those into the setcookie time()-4200 part as well.

Link to comment
Share on other sites

try a javascript redirect instead of the header, sometimes they can do weird stuff.

 

If you are on shared hosting than try the www.php.net/session_save_path  and changing that as sometimes their permissions are set kinda funky.

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.