Re: Restrict account access to single user
| From: | Tim Van Wassenhove | Date: | Thu, 15 Jul 2004 17:23:37 +0000 |
| Subject: | Re: Restrict account access to single user | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-35278@lists.php.net to get a copy of this message | ||
In article <071520041609.6071.40F6AC330005C593000017B722007354469B020103040A0B@comcast.net>,
veditio@comcast.net wrote:
> Because this is a revenue-based site, and users buy a password for access, we're wondering
> what the best php/mysql mechanism would be to allow only one person to access their account at a
> time.
> In other words, how do we prevent two users from using the same password to access the same
> account at the same time?
If a user logs in:
store the login timestamp in the database
store the uid and timestamp in a session variable.
If a user requests a page:
compare the uid and timestamp in the session with the ones in the database.
This way:
Every user that tries to login with a valid uid/pwd gets access.
Every session with the same uid but older timestamp expires.
Don't applaud, just throw money :D
--
Tim Van Wassenhove <http://home.mysth.be/~timvw>