The14thGOD Posted September 18, 2009 Share Posted September 18, 2009 Due to time and some server issues and the way the computer is set up I can not test this out till Monday, but I've read some posts about: <?php unset($_SESSION['variable1']); ?> not working for some people, is this not the right way to unset session variables? i saw something with $_SESSION = array(); but wouldn't that wipe out the entire $_SESSION variable? I just want to target about 6 variables and clear them. Also, is there some issue with making $_SESSION variables away from the intial start of the session? Im calling a script that checks to see if an admin is logged in near the top of the page, but then later on in the script i have session variables being created if it gets down through the IF's etc. so for example: <?php include('somescript.php');//this checks to see if user is logged in and is where session_start() lies //several //lines //down if($something = true){ //things happen here //another if or so if($this=$this){ $_SESSION['variable'] = 'hi'; } } ?> Thanks for any help, Justin Quote Link to comment Share on other sites More sharing options...
Garethp Posted September 18, 2009 Share Posted September 18, 2009 No, there aren't any issues with what you have said. You can use sessions the moment that you start_session(); and unset is the best way to unset a single variable (Hence the name, unset) Quote Link to comment Share on other sites More sharing options...
The14thGOD Posted September 18, 2009 Author Share Posted September 18, 2009 Ok, that's what I thought, but for some reason on another server I remember running into issues. But that really only applied to the new variable names, I didn't recall having issues with unset but I came across something the other day about it not working for session variables. Decided I should post and get it checked out. Thanks again. Jusitn 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.