Hey Michael, I think you really only need to check the $_SESSION array, not necessarily each index.

if (!isset($_SESSION)) {
  // login
  header('Location: ' . MEMBER_LOGIN_PAGE);
} else {
  // session exists
}

However, if you want to have non-empty values for your session variables you should use:

if (empty($_SESSION['username'] || empty($_SESSION['session_id']) {
  // session indexes username and / or session_id are empty
  header('Location: ' . MEMBER_LOGIN_PAGE);
}

There is a fine difference between isset() and empty(). Check the online manual or this newsgroup for further discussion.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to