Statistics | online | online number <%
' Count online user without using Global.asa
' Script by Narong Khotarasakit
' Webmaster of ezebox.com
' Bug:info@ezebox.com
SessionID = Session. SessionID
Timeout = 5
' Set how long to keep this session in minute can increase this number
conn_string = "Driver={microsoft Access DRIVER (*.mdb)};D bq=" & Server.MapPath ("Count.mdb")
' conn_string = ' activeuser '
' Set your DSN = ' activeuser ' is a better way because and need include this file to all your ASP scripts.
Set conncount =server.createobject ("ADODB.") Connection ")
Conncount.open conn_string
' Delete session after timeout
AAA = DATEADD ("n",-timeout, Now ())
Conncount.execute ("Delete * from Count where Postdate < #" & AAA & "#")
' Keep SessionID
sql0 = "Select Sess from Count where sess= '" & SessionID & "" "
Set Rscheck = Conncount.execute (sql0)
If Rscheck.eof Then
sql = "INSERT into count (sess,postdate) VALUES (' & SessionID & ', '" & Now () & "")
Conncount.execute (SQL)
End If
Rscheck.close
Set Rscheck = Nothing
' Count SessionID
SQL2 = "SELECT count (sess) from Count"
Set rs = Conncount.execute (SQL2)
Count = RS (0)
Rs.close
Set rs = Nothing
SQL3 = "SELECT * from Count"
Set Rspredel = Conncount.execute (SQL3)
Do Until rspredel.eof
Xxx=datediff ("n", Rspredel ("Postdate"), Now ())
If xxx > timeout then
Count = count-1
End If
Rspredel.movenext
Loop
Rspredel.close
Set Rspredel = Nothing
Conncount.close
Set conncount = Nothing
If Count = 0 Then
Count = 1
End If
%>
<%=count%> Active Users