Jump to content

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.

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.