Tracking user login/logout time on the web site

T

Tina

Hi,

Does anyone create a asp page to track users login and logout time?.
Thanks in advance
 
T

Thomas A. Rowe

You can track login time, etc. however you can not track logout unless the user actually click a
button/link to logout.

In IE address bar type:

? ASP Tracking User Sessions

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
M

Mike Mueller

: Hi,
:
: Does anyone create a asp page to track users login and
logout time?.
: Thanks in advance


If you are using asp to validate the users, add another sql
statement to another table to write who logged in and when
You can also use a logout button to clear their session
variables, and use a sql statement to write the log out
info. However, this will not happen if they do not logout.
 
M

Mike Mueller

I do not track exit time myself, so you'll have to come up
with an SQL statement for that to happen. Someone else may
have be able to help you out with a script to edit the login
table when the variable is abandoned or they log off

Here is what I use:

'Part 1 validates that they are a member
strSQL1 = "SELECT * FROM Roster WHERE UserName = '" & _
strUserName & "' AND Password = '" & _
strPassword &"'"

'Part II checks to see if they have Admin Status
strSQL2 = "SELECT * FROM Roster WHERE UserName = '" & _
strUserName & "' AND AdminDuty = True"

'Part III SQL setup and execution
Set objConn = Server.CreateObject ("ADODB.Connection")
objConn.Open application ("Database1_ConnectionString")

'Part III logs their attempt into the database
strSQL3 = "INSERT INTO Usage (User, UsedTime) VALUES ('"&
strUserName &"', '"& AttemptTime &"')"

Set objRS1 = objConn.Execute (strSQL1)
Set objRS2 = objConn.Execute (strSQL2)
objConn.Execute (strSQL3)

'Part IV check to see of they are authorized, and set
session variables for authorization and name
If Not objRS1.EOF Then
Session("bolAuthenticated") = True
Session("strUserName") = strUserName
End If

'Part V check to see if they have admin status, and set
session variable for admin. Then redirect based on it
If Not objRS2.EOF then
Session("bolAdmin") = True
Response.Redirect "AdminPage.asp"
Else
Response.Redirect "ClientPage.asp"
End If



Tina wrote:
: Do you have an example?. Thanks
:
: "Mike Mueller" wrote:
:
::
::: Hi,
:::
::: Does anyone create a asp page to track users login
::: and logout time?. Thanks in advance
::
::
:: If you are using asp to validate the users, add another
:: sql statement to another table to write who logged in
:: and when You can also use a logout button to clear their
:: session variables, and use a sql statement to write the
:: log out info. However, this will not happen if they do
:: not logout.
 
Top