By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,876 Members | 1,191 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,876 IT Pros & Developers. It's quick & easy.

Session Data

P: n/a
Hi All,

I'm having a small problem with sessions, or in particular some of the
data is not being saved within the session data.

To be exact, 1 variable from within an object is not being saved, but
all the other varibles within the same object are. Having a look at
the created session file, shows an unusual field relating to the
varible in question.

Session Data:
HRM_App|O:7:"hrm_app":9:{s:5:"state";a:0:{}s:7:"us er_id";s:2:"19";
s:8:"username";s:17:"d.smith";s:4:"dept";s:1:"1";s :4:"comp";s:1:"2";
s:13:"user_security";i:1;s:3:"msg";s:0:"";s:15:"de faultRedirect";s:0:"";
s:3:"cfg";a:11:{s:6:"dbtype";s:5:"mysql";}}

The odd one out is: s:13:"user_security";i:1; where all the other
fields have the following format: s:3:"msg";s:0:"";

When I query that field later on, it returns "1", not the value that
it's initialised with as part of the application login procedure
(which also sets the other variables as well).

So can someone explain what the "i" indicates, what's going on, and a
possible fix?

TIA, Chewy509.

PS. PHP 4.3.2 on Win2K with IIS.
PPS. I've searched for a description of the session file format used
by PHP, but can't find one anywhere? If someone knows of a link, then
it would be appreciated to pass on that info.
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Ch******@austarnet.com.au (Chewy509) wrote in message news:<33**************************@posting.google. com>...
Session Data:
HRM_App|O:7:"hrm_app":9:{s:5:"state";a:0:{}s:7:"us er_id";s:2:"19";
s:8:"username";s:17:"d.smith";s:4:"dept";s:1:"1";s :4:"comp";s:1:"2";
s:13:"user_security";i:1;s:3:"msg";s:0:"";s:15:"de faultRedirect";s:0:"";
s:3:"cfg";a:11:{s:6:"dbtype";s:5:"mysql";}}

So can someone explain what the "i" indicates,


IIRC, integer.

--
"I don't believe in the God who doesn't give me food, but shows me
heaven!"--Swami Vivekanandha
Email: rrjanbiah-at-Y!com
Jul 17 '05 #2

P: n/a
Chewy509 wrote:
The odd one out is: s:13:"user_security";i:1; where all the other
fields have the following format: s:3:"msg";s:0:"";

When I query that field later on, it returns "1", not the value that
it's initialised with as part of the application login procedure
(which also sets the other variables as well).

So can someone explain what the "i" indicates, what's going on, and a
possible fix?


One thing that may help you determine what is happening is to do a
var_dump of the $_SESSION array. Then you can see in human terms what
each variable is. From what I see above, $_SESSION['user_security'] = int(1)

If you are expecting a string, make sure you have quotes around the
value when assigning it to the variable. Short of that, there really
isn't enough information for more help.

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.
SEO Competition League: http://seo.koivi.com/
Jul 17 '05 #3

P: n/a
Justin Koivisto wrote in message...
Chewy509 wrote:
The odd one out is: s:13:"user_security";i:1; where all the other
fields have the following format: s:3:"msg";s:0:"";

When I query that field later on, it returns "1", not the value that
it's initialised with as part of the application login procedure
(which also sets the other variables as well).

So can someone explain what the "i" indicates, what's going on, and a
possible fix?


One thing that may help you determine what is happening is to do a
var_dump of the $_SESSION array. Then you can see in human terms what
each variable is. From what I see above, $_SESSION['user_security'] = int(1)

If you are expecting a string, make sure you have quotes around the
value when assigning it to the variable. Short of that, there really
isn't enough information for more help.


I found out what was causing it, a fault in one of the php scripts,
was assigning the variable a value, instead of comparing the value,
(the classic: "if ($user_security = 1) {" instead of "if
($user_security == 1) {" ).

I guess I should have looked harder at all the scripts that use this
variable?

Thanks again.
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.