Jump to content

isset($_SESSION) question


timecut

Recommended Posts

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!!!

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.