[nycphp-talk] Problems writing session variables

Daniel Porcher danporcher at
Thu Apr 3 20:26:55 EST 2003

I appear to be setting the Session variables within the program, but nothing
is actually being stored on the server once the program ends.  If I open the
session file after the php file is run, the file is completely blank.

At first I thought the problem was related to the fact that I was using a
redirect after I set the variables, but removing the redirect made no

Any other thoughts?

My understanding of how sessions should work is you use session_start() to
create a new session if none exists or access the current session, if it
currently exists.  Writing to a session variable will either create a new
one if it doesn't exist or overwrite an existing value if the variable has
already been created.  Is this correct?


Here are the var_dumps:

array(4) { ["action"]=> string(9) "loginuser" ["userid"]=> string(10)
"testagency" ["passwd"]=> string(6) "agency" ["submit"]=> string(5)
"Enter" }

SESSION before accessing DB:
array(0) { }

SESSION after writing variables from DB:
array(4) { ["ses_user"]=> string(10) "testagency" ["ses_access"]=> string(1)
"1" ["ses_orgtype"]=> string(1) "1" ["ses_orgid"]=> string(1) "1" }

ID: 8b516266d29b2b69fb47f2c3145f53f9

iisset(SESSION['ses_user']): 1

session_cache_expire 180

session_cache_limiter nocache

-----Original Message-----
From: Ian Forsyth [mailto:ian at]
Sent: Thursday, April 03, 2003 1:32 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Problems writing session variables


See notes below.

On Thursday, April 3, 2003, at 10:11 AM, Daniel Porcher wrote:
> function loginuser()
> {
>    global $_POST;
>    global $_SESSION;
//Add these things to debug, make sure you have data.. and see what
data you have..
print_r($_POST) . " POST <br>\
>    $userid = $_POST['userid'];
>    $passwd = $_POST['passwd'];

print_r($_SESSION) . " SESSION <br>\
>    //I validate user against DB here, if valid I write out session
> variables

// i am not sure if this is correct.. print_r the vaules of each field,
or if you can, get the whole row.. and print_r that row..
print_r($rsSecurity) . " ODBC CONNECTION SOMETHING OR OTHER <br>\
>    $_SESSION['ses_user'] = $userid;
>    $_SESSION['ses_access'] = odbc_result($rsSecurity,'AccessType');
>    $_SESSION['ses_orgtype'] = odbc_result($rsSecurity,'OrgType');
>    $_SESSION['ses_orgid'] = odbc_result($rsSecurity,'OrgID');
print_r($_SESSION) . " SESSION AFTER DB <br>\
> }

Does the correct info print out? What is there?


--- Unsubscribe at ---

More information about the talk mailing list