RE: [PHP] User authentication
| From: | Jeff McKeon | Date: | Thu, 02 Oct 2003 15:20:23 +0000 |
| Subject: | RE: [PHP] User authentication | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-164767@lists.php.net to get a copy of this message | ||
Thanks for the advise! It's a big help.
I'll go play now and come back with more intelligent questions later!
Jeff
> -----Original Message-----
> From: Dan Joseph [mailto:djoseph@duhq.us]
> Sent: Thursday, October 02, 2003 11:32 AM
> To: Jeff McKeon; Dan Joseph; php
> Subject: RE: [PHP] User authentication
>
>
> Hi,
>
> > That's great help and exactly what I'd like to do timeouts
> and all. I
> > now just need to figure out he mechanics of the code for it
> and get a
> > better understanding of sessions. I'm thinking in the user
> table I'll
> > have a bunch of boolean fields for different permissions
> that apply to
> > different pages etc. To keep it simple at first I'll just have two
> > permissions "read only" and "edit". Read only users will not be
> > allowed to access pages where they can edit data.
> >
> > How do you check for idle? I suppose there is a built in variable
> > that you check against the value in the table. How do I pull up or
> > refer to session variables?
>
> Sessions are stored in the $_SESSION array. A simple
> check would be:
>
> if ($_SESSION['user_id'] == "" ||
> is_null($_SESSION['user_id'])) redirect_to_index_function();
>
> Where 'user_id' is, that would be the name of the
> session you created. Just insert that at the top of each page
> (might be best suited in an include file).
>
> -Dan Joseph
>
>
>