SirChick Posted February 10, 2008 Share Posted February 10, 2008 How do you kill one particular session rather than killing all of them which would end up logging out my user? I used session_destroy but that logged me out everytime ! Quote Link to comment Share on other sites More sharing options...
marcus Posted February 10, 2008 Share Posted February 10, 2008 unset($_SESSION['name']); $_SESSION['name'] = FALSE; $_SESSION['name'] = NULL; one of those should work Quote Link to comment Share on other sites More sharing options...
SirChick Posted February 10, 2008 Author Share Posted February 10, 2008 Damn this is annoying, none of them worked! This is what i got: <?php If(strtolower($_SERVER['PHP_SELF']) == '/reportedconversations.php' OR strtolower($_SERVER['PHP_SELF']) == '/filereport.php'){}Else{ If(isset($_SESSION['mailpolice'])){ unset($_SESSION['mailpolice']); $_SESSION['mailpolice'] = FALSE; $_SESSION['mailpolice'] = NULL; Echo 'i am here'; }Else{ Echo 'i am not here'; } } ?> I am here does echo.... so theres no reason for it to not unset right? But it still echo's the session! Quote Link to comment Share on other sites More sharing options...
marcus Posted February 10, 2008 Share Posted February 10, 2008 <?php session_start(); $_SESSION['name'] = "Marcus"; echo "Hello " . $_SESSION['name'] . "<br>"; unset($_SESSION['name']); echo "Hello " . $_SESSION['name']; ?> my results: Hello Marcus Hello Quote Link to comment Share on other sites More sharing options...
revraz Posted February 10, 2008 Share Posted February 10, 2008 Seems you don't understand what ISSET means. Since you do set it to FALSE and then NULL right after you unset it, it sets again. Damn this is annoying, none of them worked! This is what i got: <?php If(strtolower($_SERVER['PHP_SELF']) == '/reportedconversations.php' OR strtolower($_SERVER['PHP_SELF']) == '/filereport.php'){}Else{ If(isset($_SESSION['mailpolice'])){ unset($_SESSION['mailpolice']); $_SESSION['mailpolice'] = FALSE; $_SESSION['mailpolice'] = NULL; Echo 'i am here'; }Else{ Echo 'i am not here'; } } ?> I am here does echo.... so theres no reason for it to not unset right? But it still echo's the session! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.