timecut Posted July 16, 2007 Share Posted July 16, 2007 Hi there, i'm modifying a script which handles a member area but i can't get the utility of a couple of lines and the php manual is not enought clear for me on the matter. Basically after a user login (which username and password), the script start a session and store and pass the value of the username: $_SESSION['username'] = stripData($_POST['username']); then close the session and jump on the 1st page of the members area. Here, the page requires a file for the security controls which contains few lines and the ones i can't understand... those are (in red): if (!isset($_SESSION['username'])) { if (isset($_SESSION)) { while (list ($key, $val) = each ($_SESSION)) { session_unregister($key); } session_destroy(); } header("Location: ./login.php"); exit(); } Could anyone gives me an help to understand what's goin' on with that list function?!? the script works fine but this function is new to me and is the only thing i can't understand so really would like to get on it! cheeeeeeeeeeeeers!!! Quote Link to comment Share on other sites More sharing options...
trq Posted July 16, 2007 Share Posted July 16, 2007 Its basically exactly the same as... <?php foreach($_SESSION as $k => $v)) { session_unregister($k); } ?> is that easier to understand? Quote Link to comment Share on other sites More sharing options...
timecut Posted July 16, 2007 Author Share Posted July 16, 2007 much easier!!! thanx a lot. there's so many way for the same target using php, and i get lost easily with the syntax. i got it now. many thanx again 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.