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? Quote Link to comment 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? Quote Link to comment Share on other sites More sharing options...
psychohagis Posted March 24, 2007 Author Share Posted March 24, 2007 yes Quote Link to comment 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') { Quote Link to comment 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 | Quote Link to comment 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. Quote Link to comment 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; Quote Link to comment 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? Quote Link to comment 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']); Quote Link to comment 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 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.