sera algo similar a esto???
GLOBAL.ASA
Código PHP:
<object runat="Server" scope="Application"
id="rstActiveUsers" progid="ADODB.Recordset">
</object>
<script language="VBScript" runat="Server">
' The first thing you should notice is the top line.
' It creates an application scoped recordset object
' named rstActiveUsers that I'll use to store all
' our user information.
'
' Note: I've wrapped it for readability
en esta seccion especificas que campos usaras para almacenar, cualquier cosa, por ejemplo los campos que pedias
Código PHP:
Sub Application_OnStart()
' Selected constants from adovbs.inc
Const adInteger = 3
Const adVarChar = 200
Const adDate = 7
' Here I set up in memory active user recordset
' by adding the fields I want to it and defining
' their data types.
rstActiveUsers.Fields.Append "id", adInteger
rstActiveUsers.Fields.Append "ip", adVarChar, 15
rstActiveUsers.Fields.Append "browser", adVarChar, 255
rstActiveUsers.Fields.Append "started", adDate
rstActiveUsers.Fields.Append "finish", adDate
' Next I open our recordset so that we can use it.
' That basically gets everything ready for our
first user.
rstActiveUsers.Open
Application("NumVisitas") = 0
End Sub
ahora bien, tiempo de duracion, si el usuario no estaba, se asignan los campos, se graba
Código PHP:
Sub Session_OnStart()
' Set session timeout to 20 minutes
Session.Timeout = 20
' Set a session start time. This is pretty pointless,
' but it does ensure that we start a session and
' assign the user a session id and it can help
' troubleshooting if we ever need it.
Session("Start") = Now()
' Move to the end so records are added in order.
' Again not of any real importance, but it keeps our
' user table nice and orderly.
If Not rstActiveUsers.EOF Then rstActiveUsers.MoveLast
' Add a record and insert users data. I'm just
' storing some basic info, but naturally you're free
' to store whatever you want.
rstActiveUsers.AddNew
rstActiveUsers.Fields("id").Value = _
Session.SessionID
rstActiveUsers.Fields("ip").Value = _
Request.ServerVariables("REMOTE_HOST")
rstActiveUsers.Fields("browser").Value = _
Request.ServerVariables("HTTP_USER_AGENT")
rstActiveUsers.Fields("started").Value = _
Now()
rstActiveUsers.Update
' Now that we've got the information, all that's
' left is to display it. See test_page.asp for a
' demo. It includes the pages show_count.asp and
' show_users.asp which can also be used
' individually if desired.
Application.lock()
Application("NumVisitas") = Application("NumVisitas") + 1
Application.unlock()
End Sub
esta es la parte de salida de session, se pudiera tomar el tiempo en la salida, y lo compararias con la
rstActiveUsers.Fields.Append "started"
y te daria el tiempo de uso
Código PHP:
Sub Session_OnEnd()
' Selected constants from adovbs.inc
Const adAffectCurrent = 1
' Start at the first record
rstActiveUsers.MoveFirst
' Check each record for the SessionID
Do While Not rstActiveUsers.EOF
' Do conversion to Long to be sure we're
' comparing the same data type.
If CLng(rstActiveUsers.Fields("id").Value) = _
CLng(Session.SessionID) Then
rstActiveUsers.Delete adAffectCurrent
End If
rstActiveUsers.MoveNext
Loop
rstActiveUsers.Update
Application.lock()
Application("NumSesion") = Application("NumSesion") - 1
Application.unlock()
End Sub
Bueno, ya sabes que esto sucede cuando se apaga el equipo
Código PHP:
Sub Application_OnEnd()
' Not like it really matters, but for the sake of
' good coding practice I close the recordset when
our application is shutting down.
rstActiveUsers.Close
End Sub
realmente espero que te de una guia, a lo que necesitas
suerte