Results 1 to 2 of 2

Thread: How to handle the user status in application

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2010
    Posts
    965

    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.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width