|
-
Apr 23rd, 2013, 08:41 PM
#1
Thread Starter
Fanatic Member
How to handle the user status in application
Hi. i have a table Login Info which has the following fields: Lets say:
FK
UserID, LoginID, LoginTime, Status
Composite PK
Status is showing the current status of user whether he is login or logout. What i want is that if once user logsIn so he is not allowed to login on any other place, but if he tries to do, so a message will be displayed that you are already logged In. And when he LogsOut so his current status is LoggedOut. Please guide me that how do i do this?
There are also other complexities in it, but in start i want to work on it.
-
Apr 23rd, 2013, 08:48 PM
#2
Re: How to handle the user status in application
Pretty simple really. When the user logs in you retrieve the user record. If no matching record is returned then the login fails. If a matching record is returned but it indicates that the user is logged in then you reject the login on that basis.
You do need to consider the possibility, though, that a user will login and they will stop using the app but they will not logout. If you log the user out when the app closes then it should happen very infrequently but there's still the possibility of a crash or a power failure. One option is to have your app update a timestamp in the logged-in user's record every 10 minutes or the like and then, if the user appears to be logged in but that timestamp hasn't been updated for an hour then that suggests that they're no longer using the app and you should let them log in again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|