|
Login Session
Entry And Exit
'Sub logEntryOrExit(anAction)
Dim fs
Dim ts
Dim anIP
Dim aPath
aPath = Request.ServerVariables("PATH_TRANSLATED")
aPath = Left(aPath, instrRev(aPath, "\"))
aLogFile = aPath & "log.txt"
Session("Logfile") = aLogFile
Set fs = Server.Create0bject _
("Scripting.FileSystemObject")
Set ts = fs.OpenTextFile(aLogFile, 8, True, 0)
anIP = Request.ServerVariables("REMOTE ADDR")
Session("IP") = anIP
ts.WriteLine anAction & ": " & FormatDateTime(now(),
vbGeneralDate) & ", " & _ anIP & ", "
& Session.SessionID
ts.Close
Set ts = Nothing
Set fs = Nothing
End Sub
Sub Session_OnStart
call logEntryOrExit("Entry")
Session.Timeout=1
End Sub
Sub Session On_End
Dim fs
Dim ts
Dim anIP
Dim aLogFile
aLogFile = Session("LogFile")
Set fs = Server.Create0bject ("Scripting.FileSystemObject")
Set ts = fs.OpenTextFile(aLogFile, 8, True, 0)
ts.WriteLine "Exit" & ": " &
FormatDateTime(now(), vbGeneralDate) _
& ", " & Session("IP") & ",
" & Session.SessionID
ts.Close
Set ts = Nothing
Set fs = Nothing
End Sub
|