1:把当前的在线IP地址和访问时间存入ly数组中。 Set ThisFile=StreamF.OpenTextFile(CountFile,1,False) Countly=0 do while not ThisFile.AtEndOfStream Thisline = ThisFile.readline '使用了 Preserve 关键字,就只能调整数组最后维的大小,并且不能改变数组的维数。 '数组只有一维,该维是最后的也是仅有的一维,就可以修改该数组的大小. Redim preserve ly(Countly) ly(Countly) = Thisline 'Countly 记载这ThisFile的行数 Countly = Countly + 1 loop ThisFile.Close
2:开始刷新访问当前网页IP地址 sj中存的当前的系统时间 sameip=0 for i=1 to (Countly-1)/2 '取得 偶数列 '如果在刚才统计的在线IP地址和当前的时间超过了一分钟,则上出该IP if DateDiff("s",ly(i*2),sj)>60 then ly(i*2-1)="" ly(i*2)="" Countly=Countly-2 end if
'获取刚才在线的IP地址,如果现在还在线 'Request.ServerVariables("REMOTE_ADDR") 获得发出请求机器的IP if Request.ServerVariables("REMOTE_ADDR")=ly(i*2-1) then sameip=1 ly(i*2)=sj end if next
3:将最新的访问当前网页的IP地址存入People.asp '开始向People.asp这个文件写数据 set OutFile=StreamF.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
Copyright 2001-2010, www.comprg.com.cn, All Rights Reserved 京ICP备14022230号-1,电话/传真:010-82561037 82561614 ,Mail:gaojian@comprg.com.cn
地址:北京市海淀区远大路20号宝蓝大厦E座704,邮编:100089