Page 1 of 1
Don want same person to login at the same time
Posted: Tue Apr 20, 2004 10:22 pm
by ng_king
Pls help:
I dun want to let the same login ID to login at the same time. how can this be done. pls give me some guidance.
Posted: Wed Apr 21, 2004 12:06 pm
by PrObLeM
i would have a flag saying in the db 1 being loged in and 0 being not...but this presents a problem...if the person does not logout and close the browser but they try to log back in they wont beable to ...but what you could do is after 30 mins from loggin in the script updates the flag to 0
hopefully this helps...and maybe there is an easyer solution.
[my 100th post w0ot w0ot]
Posted: Wed Apr 21, 2004 12:26 pm
by JAM
I assume you are using a database of some sort, as you didn't mention this. You might want to take ideas from this:
viewtopic.php?t=19355
If you do not know what a "useronline script" is, try
searching for it in these forums.
Take a look at it, and get back if you still get stuck. It isn't completely what you wanted, but with just abit of rewriting, it would suit you greatly.
Posted: Wed Apr 21, 2004 10:32 pm
by ng_king
The method u suggest is not suitable from my concept. ok if the same user login after 30 mins then there will be 2 same user using the same account. i dun want the 2 user to login using the same account. i cannot use flag also coz wat if the user close the browser then i might not update the flag. do you have any other suggestions
thanks.
PrObLeM wrote:i would have a flag saying in the db 1 being loged in and 0 being not...but this presents a problem...if the person does not logout and close the browser but they try to log back in they wont beable to ...but what you could do is after 30 mins from loggin in the script updates the flag to 0
hopefully this helps...and maybe there is an easyer solution.
[my 100th post w0ot w0ot]
Posted: Thu Apr 22, 2004 3:12 am
by timvw
what you could do:
use sessions/cookies to track down the last page request of a user. And then check at regular times if you should logout the user.
Posted: Fri May 21, 2004 5:03 am
by fastfingertips
You do not need any of that

.
As i know (for example i'm using a session system developed by myself which uses MySQL) a session belongs to a user (a userid), so just check if a session exists for that user if returned rows>0 then block him

.
In this way you do not need flags or any other thing.
Posted: Tue Jun 08, 2004 11:46 pm
by valen53
fastfingertips wrote:You do not need any of that

.
As i know (for example i'm using a session system developed by myself which uses MySQL) a session belongs to a user (a userid), so just check if a session exists for that user if returned rows>0 then block him

.
In this way you do not need flags or any other thing.
Regarding the "session system developed by urself", can u make it more clearly ? like concept, or how to do .. cause i also face this kind of problem.
Posted: Wed Jun 09, 2004 3:13 am
by Findus
You can make your own session handler that uses database instead of files, and thus you can easily track whatever information you want.
Found one tutorial for you:
http://www.phpbuilder.com/columns/ying2 ... hp3?page=1
Im pretty sure there is a really good tutorial of this over at the zend site, but i cant find it.
Posted: Wed Jun 09, 2004 3:27 am
by patrikG
Zend's tutorial is at
http://www.zend.com/zend/tut/session.php
It's the easiest way to handle sessions for a "unique login", as you suggest, in the database.
Don't use the IP to verify the uniqueness of a user's session-data, I'd use fastfingertips suggestion of using a numrow-query. The reason for this is that AOL distributes the IPs per HTTP-request - hence an AOL user can have many different IPs during one session.
Posted: Wed Jun 09, 2004 8:29 am
by Grim...
Posted: Wed Jun 09, 2004 8:38 am
by dreamline
I'm using something that JAM was talking about... Take a look at a basic user online script, modify it to your needs (rewriting is in order) and it should work... I don't have a clear idea, but for my needs it works.. Users can login multiple times on my site, but as JAM said take a basic useronline script and start playing with it..
