None of these worked for me. ok, if you look at the code, the part where "echo $_SESSION['uid'];" is actually works.
I get a print out of the variable. if i call session_start() before anything, set variables in $_SESSION, and check it on another page, the session variables do not exist. in fact, the session isnt even started, cause I get an "Undefined variable _SESSION". so, it looks like the session is not spamming page requests. Do I have to call session_start() on every page to read the $_SESSION variables set in another?



Shivanischal A wrote:


John,

I can think of 3 problems...
1. I'm not sure, but try inserting a 'session_start()' in file.php
2. in ur validateadminlogin() method, the mysql_close() never seems to get
called.
3. try $_SESSION['uid'] . use ' instead of ". " seema to cause problems in
some cases.

best of luck,
-shiva

----- Original Message -----
From: "John Manko" <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Monday, June 30, 2003 6:49 AM
Subject: IsSet() and $_SESSION




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();

}







DISCLAIMER: This email is bound by the terms and conditions described at http://www.subexgroup.com/mail-disclaimer.htm








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



Reply via email to