JSP online number of people statistics code program
/*
┌──────────────────── Deep Space Depth Learning ──┐
│ Function Name: Onlinecount
│ Role: Online population statistics
│ Parameters:
│ return value:
│ Date: 2006/7/18
└────────────────────www.deepteach.com──┘
*/
String Onlinecount ()
{
T= (CInt (Date ()) *24+cint (Hour (Time ())) *60+cint (Minute (Time ()))
K=0
I=1
Y=0
Do While application ("Onlineip" &i) <> ""
If Application ("Onlineip" &i) =request.servervariables ("REMOTE_ADDR") Then
Application ("Onlinedata" &i) =t
Y=1
End If
If T-application ("Onlinedata" &i) >9 or T<application ("Onlinedata" &i) Then
K=k+1
Else
If K>0 Then
Application.Lock
Application ("Onlineip" &i-k) =application ("Onlineip" &i)
Application ("Onlinedata" &i-k) =application ("Onlinedata" &i)
Application.UnLock
End If
End If
If K>0 Then
Application.Lock
Application ("Onlineip" &i) = ""
Application.UnLock
End If
I=i+1
Loop
If Y=0 Then
Application ("Onlineip" &i) =request.servervariables ("REMOTE_ADDR")
Application ("Onlinedata" &i) =t
Else
I=i-1
End If
Response.Write (i)
}
%>