Hello all,

I'm having some trouble using Session variables it seems with a small web
application I'm creating for time reporting.  I'm using IIS 5.0, Windows
2000 Professional.  Any reason why it wouldn't seem to be keeping session
variables?  Code is:

//check login and password
//connect and execute query
$connection = &NewADOConnection('mssql');
$connection->PConnect($servername, $userid, $password, $database) or
die("Unable to connect to your database!");
$recordset = &$connection->Execute("Select uid, uperms From tblUsers Where
uname = '$frmuser' AND upass = '$frmpass'") or die ("Error in execution of
recordset!");

//if row exists login and pass are correct
if ($recordset->RecordCount() == 1) {
        
        //initiate a session
        session_start();

        //register the user's ID and permission level
        session_register("SESSION_UID");
        session_register("SESSION_UPERMS");
        $uid = $recordset->fields["uid"];
        $uperms = $recordset->fields["uperms"];
        $SESSION_UID = $uid;
        $SESSION_UPERMS = $uperms;

        //redirect to Main Menu page
        header("Location:menu.php");

        //close connection
        $connection->Close();
        $recordset->Close();

}else{
        
        //login password check failed
        $connection->Close();
        
        //redirect to error page
        header("Location: error.php?ec=0");
        exit;
}

Whenever I print off the $recordset->RecordCount() it tells me that it's 1,
which is correct, so it should start the session and send them to menu.php.
It actually does send them to menu.php, but menu.php checks to verify the
Session like so:

<?
//check for valid user session
session_start();
if(!session_is_registered("SESSION_UID"))
{
        header("Location: error.php?ec=1");
        exit;
}
?>

And it sends them back to the error page saying they don't have the Session
(because that's what I have on my error page if ec=1).  Any suggestions?
What am I doing wrong here?  Are there settings in PHP.ini that I'm missing?
Thanks!

David

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to