A practical real-time statistics online number of fso-

Source: Internet
Author: User
Tags date readline servervariables trim
fso| Statistics | online | Number of people online


Count.asp:

<%server.scripttimeout=300
Id=trim (Request.QueryString ("id"))
Fc=trim (Request.QueryString ("FC"))
If fc= "" Then fc= "FFFF00"
Bg=trim (Request.QueryString ("BG"))
If bg= "" Then bg= "000000"
Bc=trim (request.querystring ("BC"))
If bc= "" Then bc= "00FF00"
Sername=request.servervariables ("SERVER_NAME")
Scrname=request.servervariables ("Script_name")
Linkurl= "http://" & Sername & Scrname
%>
<title> Real-time statistics online number </title>
<meta http-equiv= "Refresh" content= "10; Url=<%=linkurl%> ">" Refreshed 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>
<%
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
' Format date, time
Dim ly ()
Set Thisfile=fs. OpenTextFile (Countfile,1,false)
Countly=0
Do as not thisfile. AtEndOfStream
Thisline = Thisfile.readline
Redim Preserve ly (countly)
Ly (countly) = Thisline
countly = countly + 1
Loop ' reads the contents of the people.asp into the array
Thisfile.close
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 Request.ServerVariables ("REMOTE_ADDR") =ly (i*2-1) Then
Sameip=1 ' IP already exists
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 ' Add new record
OutFile. Close
End If
Set Thisfile=fs. OpenTextFile (Countfile,1,false)
Countly=0
Do as not thisfile. AtEndOfStream
Thisline = Thisfile.readline
Redim Preserve ly (countly)
Ly (countly) = Thisline
countly = countly + 1 ' Total number of record rows
Loop
Thisfile.close
Total= (countly-1)/2 ' total statistics, each has two lines of records: IP, Time
%>
<body>

<p><select name= "Online" size= "1" >
<option selected value= "online" ><%=total%> person on line </option>
<%
For I=1 to Total
Response.Write "<option>" &ly (i*2-1) & "</option>"
Next
%>
</select></p>
</body>

People.asp:

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




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.