session vars set in functions invalid??
| From: | Michael Geary | Date: | Tue, 19 Dec 2000 16:48:34 +0000 |
| Subject: | session vars set in functions invalid?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-31063@lists.php.net to get a copy of this message | ||
Hi all,
I am trying, as I'm sure many others are, to come up with a compact user
authentication/login scheme.
It seems to me that for my purposes, the best way to go is to run a function
which receives the username and supplied password. A lookup in my database
is performed, and a session variable is set which tells me who the user is.
My database lookup works just fine. However, It appears that session
variable scope doesn't penetrate outside of functions. Can this be? I
thought the whole point of session variables was that they are accessible
from anywhere. If I can't set a session variable within a function, then it
appears that I have to in-line code the authentication process wherever it
is needed, which seems rather silly to me.
Unless I can get some clarity on this, it seems I will have to roll my own
session handling using a temporary database table. Can anyone give me some
help to spare me from this work?
Thanks in advance,
michael geary