global variables, sessions, cookie, includes
| From: | Seth Lepzelter | Date: | Sun, 11 Jun 2000 10:42:44 +0000 |
| Subject: | global variables, sessions, cookie, includes | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-1558@lists.php.net to get a copy of this message | ||
Hello, all.
I'm trying to set up a system to use cookies and/or sessions to keep track
of database usernames and passwords, among a few other things. And, I've
taken to writing "library" include files that have all of my general
functions in them.
I've run into a problem with this though. It seems that session
variables, and cookie data is not available to the included file. for
example:
in the included file,
function isLoggedIn(){
if((isset($HTTP_COOKIES_VARS['user'])) &&
(isset($HTTP_COOKIES_VARS['pass']))){
return 1;
}
return 0;
}
returns 0 even though those cookies are there.
however, in the top-level file,
if(!(isset($HTTP_COOKIE_VARS['user'])) &&
(isset($HTTP_COOKIE_VARS['pass']))){
print_expired();
}
works correctly(calls print expired if the cookies are not there, and
doesnt if they are...).
Am I missing something here?
I also tried something similar with sessions and ran into problems of the
same ilk.
Any help would be appreciated,
Seth Lepzelter
UNIX System Admin
FedEx Sort Systems Support