How to track user login time and logout time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fairy1992224
    New Member
    • Oct 2011
    • 1

    How to track user login time and logout time

    I had created a database to capture the user logged in time and user logged out time. But may I know how do I code what time the user had logged in and logged out in my login and logout page so that it will store in the database?
  • michaeldebruin
    New Member
    • Feb 2011
    • 134

    #2
    I don't know if it is the best way to do it, but I always simply use an if statement and a bool variable. When somebody is logging in switch the bool to true and use the if statement (and a timespan) to catch the time and save it in the database. And the same plan for logging off. Switch the boolean to false and again use an if statement to catch the time and save it in to the database.
    But if you have more experience with background workers I think it should be possible to use them to get the same result.

    Comment

    Working...