RE: [PHP] User authentication

From: Date: Thu, 02 Oct 2003 18:14:15 +0000
Subject: RE: [PHP] User authentication
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-164795@lists.php.net to get a copy of this message
Hi, > 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? Yeah, that's correct. There is a date_idle column in the database. That gets updated everytime they move to a new page, or refresh the one they are on. To time them out, I simply set the date_out column = Now(), issue a session_destroy() and redirect them back to the login page. -Dan Joseph

« previous php.general (#164795) next »