psychohagis Posted March 24, 2007 Share Posted March 24, 2007 I have a system which uses three session variables; 'rank', 'username' and 'userid'. I was doing the following on 'sign-out' to get rid of these variables: $_SESSION = array(); session_destroy(); Which seemed to work as when I checked against uderid: if (!isset($_SESSION['userid']) or $_SESSION['userid'] =='') { exit('You are not signed in!'); } It told me I wasnt signed in. I then wanted to do the following: <?php if ($_SESSION['rank']=='webmaster' OR $_SESSION['rank']=='chairman' OR $_SESSION['rank']=='secretary' OR $_SESSION['rank']=='treasurer') { ?> <br /> <div class="shinydiv"> <div class="title"> Admin</div> <p> <?php echo $_SESSION['rank'] ?> </p> </div> <?php } ?> And for some reason it still appeared If I signed out. I tried dumping all the session variables and the rank variable was the only one that showed up. What's going wrong? Link to comment https://forums.phpfreaks.com/topic/44110-solved-one-session-variable-not-being-destroyed/ Share on other sites More sharing options...
papaface Posted March 24, 2007 Share Posted March 24, 2007 Do you have session_start(); at the top of every page using sessions? Link to comment https://forums.phpfreaks.com/topic/44110-solved-one-session-variable-not-being-destroyed/#findComment-214164 Share on other sites More sharing options...
psychohagis Posted March 24, 2007 Author Share Posted March 24, 2007 yes Link to comment https://forums.phpfreaks.com/topic/44110-solved-one-session-variable-not-being-destroyed/#findComment-214167 Share on other sites More sharing options...
Greaser9780 Posted March 24, 2007 Share Posted March 24, 2007 Try the following: if ($_SESSION['rank']=='webmaster' | $_SESSION['rank']=='chairman' | $_SESSION['rank']=='secretary' | $_SESSION['rank']=='treasurer') { Link to comment https://forums.phpfreaks.com/topic/44110-solved-one-session-variable-not-being-destroyed/#findComment-214168 Share on other sites More sharing options...
JasonLewis Posted March 24, 2007 Share Posted March 24, 2007 maybe its something to do with when your setting them? and Greaser8780 its || not | Link to comment https://forums.phpfreaks.com/topic/44110-solved-one-session-variable-not-being-destroyed/#findComment-214170 Share on other sites More sharing options...
Greaser9780 Posted March 24, 2007 Share Posted March 24, 2007 Huh I usually use one with no probs. Lucky so far I guess. Link to comment https://forums.phpfreaks.com/topic/44110-solved-one-session-variable-not-being-destroyed/#findComment-214174 Share on other sites More sharing options...
psychohagis Posted March 24, 2007 Author Share Posted March 24, 2007 This how I set them: session_start(); $_SESSION['userid'] = $userid; $_SESSION['username'] = $_POST['username']; $_SESSION['rank'] = $rank; Link to comment https://forums.phpfreaks.com/topic/44110-solved-one-session-variable-not-being-destroyed/#findComment-214176 Share on other sites More sharing options...
JasonLewis Posted March 24, 2007 Share Posted March 24, 2007 so when you echo out the data that your putting in your getting the correct values? Link to comment https://forums.phpfreaks.com/topic/44110-solved-one-session-variable-not-being-destroyed/#findComment-214180 Share on other sites More sharing options...
papaface Posted March 24, 2007 Share Posted March 24, 2007 Do this: session_start(); $_SESSION = array(); session_destroy(); unset($_SESSION['userid']); unset($_SESSION['username']); unset($_SESSION['rank']); Link to comment https://forums.phpfreaks.com/topic/44110-solved-one-session-variable-not-being-destroyed/#findComment-214198 Share on other sites More sharing options...
psychohagis Posted March 24, 2007 Author Share Posted March 24, 2007 Thanks that last suggestion seemed to work Link to comment https://forums.phpfreaks.com/topic/44110-solved-one-session-variable-not-being-destroyed/#findComment-214308 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.