Re: User Authentication
| From: | Chris Shiflett | Date: | Tue, 18 Mar 2003 18:41:41 +0000 |
| Subject: | Re: User Authentication | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-140159@lists.php.net to get a copy of this message | ||
--- shaun <shaun@mania.plus.com> wrote:
...
> > > $ses_name = $suser_name;
> > > $ses_pass = $suser_password;
> > > $ses_level = $stype_level;
> > >
> > > session_register("ses_name");
> > > session_register("ses_pass");
> > > session_register("ses_level");
> >
> > This is the moment where you lose your new session data. You need to
> > register your session variables before you use them. At this point, PHP
> > retrieves the session data that is saved for you, and you lose all of the
> > stuff you did above.
...
> sorry but you have lost me, surely the session_register(); function is
> storing what I have done above this point, if not then how would I store the
> new values instead?
How is a function supposed to do anything before it is called? I don't
understand how you come to that conclusion.
The session_register() function lets PHP know that you want a particular
variable registered in the current session. If the variable already exists, it
will retrieve it for you. This is how you are able to use a session variable on
another page.
If you don't udnerstand this, you might want to just use session_register() at
the top of your script(s) to keep yourself from making this particular mistake.
However, I strongly suggest researching sessions a lot more, or you will find
it frustratingly difficult to solve session problems without a good
understanding of what is going on.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/