Preventing multiple logins useing same username

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sasamitrovic
Forum Newbie
Posts: 1
Joined: Wed Jul 17, 2002 1:51 pm

Preventing multiple logins useing same username

Post by sasamitrovic »

Hi,

I am new to this forum and I'm not sure whether this topic has been previously discussed, so I apologise if it has. Does anyone have any ideas how to efficently prevent a user to log in with his username more than once at a time. I am using session control and my first idea was to maintain a database of all the users curerently logged in and not to let a user log in if his username is in the database. But, what happens when a logged-in user simply shuts down his browser without logging out previously?
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

Well, in your instance, we do this. If the users goes to log back in, and a session still exists for that users, we delete that session from the database first, and then add that users new session information.

This means essentially, that if I log in a second time, I automatically log out my first instance.
User avatar
cheatboy00
Forum Contributor
Posts: 151
Joined: Sat Jun 29, 2002 10:36 am
Location: canada
Contact:

Post by cheatboy00 »

... so if i was to log in on this particular system and shut down my browser will it still count you as loged in... hmm... i might use this way.. cookies are annoying
Post Reply