IsSet() and $_SESSION

From: Date: Mon, 30 Jun 2003 01:19:24 +0000
Subject: IsSet() and $_SESSION
Groups: php.general 
Request: Send a blank email to php-general+get-153346@lists.php.net to get a copy of this message
I'm having a problem with the value that isset returns on $_SESSION variables. For some reason, even if $_SESSION['uid'] is set, isset returns FALSE. Here is the code: ------ file1.php ----------- include "file2.php"; if (!isset($_SESSION["uid"])) { // This first time $_SESSION["uid"] is check, we should // end up in here. However, ValidAdminLogin (next test) // will set $_SESSION["uid"] so next time we will not // get here. if ( !ValidAdminLogin($_POST["adminid"],$_POST["adminpass"])) forceadminlogin(); } elseif ( !ValidAdminSession() ) forceadminlogin(); // this is done to show that $_SESSION["uid"] is being set // but isset still returns false echo $_SESSION["uid"]; ------ file2.php ----------- function ValidAdminLogin($user, $pass){ global $_SESSION; if (The_MYSQL_Stuff_Is_NOT_OK) return false; else { session_start(); $_SESSION["logged"] = true; $_SESSION["username"] = $user; $_SESSION["adminlogin"] = true; $_SESSION["fname"] = $fname; $_SESSION["lname"] = $lname; $_SESSION["email"] = $email; $_SESSION["uid"] = session_id();
    	  return true;
} mysql_close(); }

« previous php.general (#153346) next »