NYCPHP Meetup

NYPHP.org

[nycphp-talk] User Login / Auth Class - SIMPLISTIC please

Mitch Pirtle mitchy at spacemonkeylabs.com
Wed Jan 28 20:13:52 EST 2004


-sry wrote:

> On January 28, 2004 6:52 PM "Mitch Pirtle" wrote:
> 
>>-sry wrote:
>>
>>>ya' got something to cut n' paste that's *this* simple? :)
>>
>>Ok, but only for you ;^)
> 
> 
> Awww, gee, shucks <bats eyelashes then remembers>
> but umm, I think now you've gotten too simple. This is
> tracking my session? it seems to be just a form validation,
> which is nice, but I want to fake "saving state" in the stateless
> environment we call the web browser. Can't PHP create a
> an instance of a "session" that contains the user's state?
> (what page they are on, what forms they have / haven't 
> completed, what default StyleSheet they prefer, etc.)
> 
> The specific properties of the state object don't really
> matter (as I will edit to suit my needs) but I guess I'm
> looking for a class that already has the methods built for
> me to set and retrieve property values, catch and handle
> "errors" (you didn't read unit 3 yet, sorry, no unit 4 until
> you finish your vegetables)  Is there something like that
> out there?

If you are really after a class, then http://www.phpclasses.org/ may 
have what you are looking for.  What I was trying to point out was that 
once someone submitted 'form1', you could set it as a $_SESSION 
variable.  You could even just set $_SESSION['form_1']=TRUE and be done 
with it - PHP4 tracks that for you (no muss, no fuss, no messy 
applicator brush!)...  Please see 
http://us3.php.net/manual/en/ref.session.php for more details.

In short, you can set $_SESSION['foo'] in one script, and then reference 
it in another - as long as that session is taking place (typically in a 
cookie or in the URL).  So just set your variables for each form in 
$_SESSION, and as long as that user is at your site you will see where 
they have been, what they've done, etc.  The server takes care of all 
the rest.  No security whatsoever, but you wanted easy.

And as for the cats, I once had a small tower that could be turned off 
by my cat as she rubbed up against the case; but our Swiss cat is only 
interested in stealing my seat.

-- Mitch



More information about the talk mailing list