Jump to content

Deleting cookie for logout session


acctman

Recommended Posts

my logout process doesn't seem to be working. when the user clicks logout the session remains. from what I can see the cookie is being deleted but its still leaving the user logged in.

 

 

http://www.site.com/index.php?req=logout

 

index.php

if ($req == 'logout')           include 'includes/verify_session.php';

 

 

verify_session.php

//process logout
if ($req == "logout") {
        ob_clean();
        $_SESSION = array();
        if ($term==1)
           {
           header("Location:".constant('dir').'index.php?req=login&login_message='.urlencode("Your Account has now been Suspended and within the next 48hrs it will automatically be deleted. As of right now your account is no longer visible on the site."));	
           }else{
           header("Location:".constant('dir').'index.php?req=login&login_message='.urlencode(_logged_out));
           }
        setcookie('remember','FALSE',time()-360000,constant('dir'));
        exit;
        }

Link to comment
https://forums.phpfreaks.com/topic/62683-deleting-cookie-for-logout-session/
Share on other sites

If you're using sessions, why do have a separate cookie? You should look into the PHP Manual on session functions and see how you can alter the session id's cookie (such as expiration, etc).

Why are you using the code

$_SESSION=array();

? That might work, but I doubt it will. Use session_destroy() to clear your data (you can find more info on this in the manual).

 

Also, why do you pass your status notification in the URL query? That isn't the best method you can use.

If you're using sessions, why do have a separate cookie? You should look into the PHP Manual on session functions and see how you can alter the session id's cookie (such as expiration, etc).

Why are you using the code

$_SESSION=array();

? That might work, but I doubt it will. Use session_destroy() to clear your data (you can find more info on this in the manual).

 

Also, why do you pass your status notification in the URL query? That isn't the best method you can use.

 

unfortunantely thats how the script was made =( not the best coding. for a person like me that is learning PHP it doesn't good coding to learn from.

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.