RE: [PHP] User authentication
| From: | Jeff McKeon | Date: | Thu, 02 Oct 2003 17:59:17 +0000 |
| Subject: | RE: [PHP] User authentication | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-164791@lists.php.net to get a copy of this message | ||
> Hi,
>
> > What is stored in the date_out column? Is that one of the
> colums in
> > your own created table or a standard one?
>
> That's the SQL table that I use to track sessions. Its
> one I created. I have a functon that does a simple SQL query:
>
> SELECT date_out FROM sessions WHERE user_id = 12
>
> Then I check to see if if date_out != 0000-00-00
> 00:00:00 and log them out if it doesn't. This method is both
> good and bad. (1) I have a master log of all user logins.
> (2) I can force a user to log out. Overall, it was just more
> work on the sessions. I guess I'd recommend this method if
> you have to keep strong security in mind.
>
So when a user logs in you write a user_id and datestamp to a field in
your sessions table. Every time the person accesses a page you update
the datestamp in that record. Then you run a function that checks every
X minutes if the timestamp is older than X minutes and if so you log the
person out? Is this correct? How exactly do you log them out? By
issuing a command to clear the session variables saved during login,
thus causing function on each page that checks for valid login to fail?
Thanks,
Jeff