Page 1 of 1

session varible undefined

Posted: Fri Oct 04, 2002 9:33 pm
by brcolow
i have this line to validate a session..

Code: Select all

if (session_is_registered("valid_user"))

obviously because this is a windows machine it says undefined varbile, so should it be something like...

Code: Select all

if (session_is_registered("$HTTP_POST_VARSї'vaild_user]'))
But that doesnt work, how should i do this?
Thanks,
Brcolow

Posted: Sat Oct 05, 2002 12:58 am
by mydimension
that should work, even on a windows machine. i use sessions on my WinXP dev server. perhaps you could show us the context that the code is used in. would help us better understand what you are trying to do.

also have a look at this: http://www.php.net/manual/en/function.s ... stered.php for it seems to have some good pointers on how to check if a variable is registered in the session.

Posted: Sat Oct 05, 2002 6:47 am
by twigletmac
Instead of using session_is_registered() try this if you are using PHP 4.0.6 or below:

Code: Select all

if (isset($HTTP_SESSION_VARSї'valid_user'])) {
or this if you are using PHP 4.1 or above:

Code: Select all

if (isset($_SESSIONї'valid_user'])) {
Mac