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
https://forums.phpfreaks.com/topic/60232-isset_session-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.