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 ! Link to comment https://forums.phpfreaks.com/topic/90383-session-kill/ 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 Link to comment https://forums.phpfreaks.com/topic/90383-session-kill/#findComment-463385 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! Link to comment https://forums.phpfreaks.com/topic/90383-session-kill/#findComment-463388 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 Link to comment https://forums.phpfreaks.com/topic/90383-session-kill/#findComment-463390 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! Link to comment https://forums.phpfreaks.com/topic/90383-session-kill/#findComment-463395 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.