count.asp:
1Server.ScriptTimeout=300
2id=Trim(Request.QueryString("id"))
3fc=Trim(Request.QueryString("fc"))
4if fc="" then fc="FFFF00"
5bg=Trim(Request.QueryString("bg"))
6if bg="" then bg="000000"
7bc=Trim(Request.QueryString("bc"))
8if bc="" then bc="00FF00"
9sername=Request.ServerVariables("SERVER_NAME")
10scrname=Request.ServerVariables("SCRIPT_NAME")
11linkurl="http://" & sername & scrname
1<html>
2<head>
3<title>实时统计在线人数</title>
4<meta content="10; URL=```
5=linkurl
6```" http-equiv="Refresh"/> '每隔10秒刷新
7<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
8<style type="text/css">
9<!--
10P {FONT-SIZE: 9pt; font-color: #eeeeee}
11A {TEXT-DECORATION: none}
12A:link {COLOR: #0068A3}
13A:visited {COLOR: #0068A3}
14A:hover {COLOR: #2f00ff; TEXT-DECORATION: underline}
15.ourfont {font-size: 9pt }
16BODY { FONT-SIZE: 9pt}
17TABLE { FONT-SIZE: 9pt}
18\-->
19</style>
20</head>
countfile=server.mappath("people.asp")
Set fs=CreateObject("Scripting.FileSystemObject")
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
'格式化日期、时间
dim ly()
Set thisfile=fs.OpenTextFile(countfile,1,False)
countly=0
do while not thisfile.AtEndOfStream
thisline = thisfile.readline
Redim preserve ly(countly)
ly(countly) = thisline
countly = countly + 1
loop '将people.asp中内容读到数组中
thisfile.close
sameip=0
for i=1 to (countly-1)/2
if DateDiff("s",ly(i2),sj)>60 then
ly(i2-1)=""
ly(i2)=""
countly=countly-2
end if
if Request.ServerVariables("REMOTE_ADDR")=ly(i2-1) then
sameip=1 'IP已经存在
ly(i*2)=sj
end if
next
set outfile=fs.CreateTextFile(countfile)
for i=0 to countly-1
if ly(i)<>"" then
outfile.WriteLine ly(i)
end if
next
if sameip=0 then
outfile.WriteLine Request.ServerVariables("REMOTE_ADDR")
outfile.WriteLine sj '添加新记录
outfile.Close
end if
Set thisfile=fs.OpenTextFile(countfile,1,False)
countly=0
do while not thisfile.AtEndOfStream
thisline = thisfile.readline
Redim preserve ly(countly)
ly(countly) = thisline
countly = countly + 1
loop
thisfile.close
total=(countly-1)/2 '统计总人数
1<body>
2<p><select name="Online" size="1">
3<option selected="" value="Online">```
4=total
5```人在线上</option>
for i=1 to total
response.write "<option>"&ly(i*2-1)&"</option>"
next
1</select></p>
2</body>
3</html>
people.asp:
1Response.end
172.16.20.230'用户IP
2003-06-15 09:53:57'登录时间