Skip to main content
Known Participant
October 20, 2009
Answered

track user time logged in

  • October 20, 2009
  • 1 reply
  • 929 views

I need to build a simple login and have a visitor view a movie clip then log out. I need to store in a database how long the user was logged in using asp. Can anyone help? I can build the login i just need to know how to log users time logged in.

This topic has been closed for replies.
Correct answer bregent

The part to code the time stamp for both and the math code


Store the current time at login in a session variable:

Session("logintime")=Now

Calculate the elapsed time in seconds:

DateDiff("s",Session("logintime"),now)

1 reply

Participating Frequently
October 20, 2009

When they log in, store the date/time in a session variable. When they log out, calculate the difference between the current and stored time, and then insert that into your database.

Known Participant
October 21, 2009

Can u provide a code sample?

bregentCorrect answer
Participating Frequently
October 22, 2009

The part to code the time stamp for both and the math code


Store the current time at login in a session variable:

Session("logintime")=Now

Calculate the elapsed time in seconds:

DateDiff("s",Session("logintime"),now)