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();
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php