SoFunction
Updated on 2025-04-13

A practical FSO-Real-time statistics on online users

:

<%=300
id=Trim(("id"))
fc=Trim(("fc"))
if fc="" then fc="FFFF00"
bg=Trim(("bg"))
if bg="" then bg="000000"
bc=Trim(("bc"))
if bc="" then bc="00FF00"
sername=("SERVER_NAME")
scrname=("SCRIPT_NAME")
linkurl="http://" & sername & scrname
%>
<html>
<head>
<title>Real-time statistics on online users</title>
<META HTTP-EQUIV="Refresh" content="10; URL=<%=linkurl%>"> 'Refresh every 10 seconds
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style TYPE="text/css">
<!--
P {FONT-SIZE: 9pt; font-color: #eeeeee}
A {TEXT-DECORATION: none}
A:link {COLOR: #0068A3}
A:visited {COLOR: #0068A3}
A:hover {COLOR: #2f00ff; TEXT-DECORATION: underline}
.ourfont {font-size: 9pt }
BODY { FONT-SIZE: 9pt}
TABLE { FONT-SIZE: 9pt}
-->
</style>
</head>
<%
countfile=("")
Set fs=CreateObject("")
n=Year(date())
y=Month(date())
r=Day(date())
s=Hour(time())
f=Minute(time())
m=Second(time())
if len(y)=1 then y="0" & y
if len(r)=1 then r="0" & r
if len(s)=1 then s="0" & s
if len(f)=1 then f="0" & f
if len(m)=1 then m="0" & m
sj = n & "-" & y & "-" & r & " " & s & ":" & f & ":" & m
'Format date, time
dim ly()
Set thisfile=(countfile,1,False)
countly=0
do while not
thisline =
Redim preserve ly(countly)
ly(countly) = thisline
countly = countly + 1
loop 'Read the content into the array

sameip=0
for i=1 to (countly-1)/2
if DateDiff("s",ly(i*2),sj)>60 then
ly(i*2-1)=""
ly(i*2)=""
countly=countly-2
end if
if ("REMOTE_ADDR")=ly(i*2-1) then
sameip=1 'IP already exists
ly(i*2)=sj
end if
next
set outfile=(countfile)
for i=0 to countly-1
if ly(i)<>"" then
ly(i)
end if
next
if sameip=0 then
("REMOTE_ADDR")
sj'Add a new record

end if
Set thisfile=(countfile,1,False)
countly=0
do while not
thisline =
Redim preserve ly(countly)
ly(countly) = thisline
countly = countly + 1' Total number of records
loop

Total=(countly-1)/2 'Calculate the total number of people, each person has two rows of records: IP, time
%>
<body>

<p><select name="Online" size="1">
<option selected value="Online"><%=total%>People online</option>
<%
for i=1 to total
"<option>"&ly(i*2-1)&"</option>"
next
%>
</select></p>
</body>
</html>

:

<%%>
172.16.20.230'User IP
2003-06-15 09:53:57'Login time