Let the site Live (4)

Source: Internet
Author: User
Tags array current time servervariables
Online IP Address


Features: Displays the current number of online Web pages and IP addresses.
Methods: The current Web page online IP address into the people.asp, every one-minute automatic refresh, used to calculate the current page number of online and IP address.

1: The current online IP address and access time into the LY array.
Set Thisfile=streamf.opentextfile (Countfile,1,false)
Countly=0
Do as not Thisfile.atendofstream
Thisline = Thisfile.readline
' Using the Preserve keyword, you can only resize the last dimension of the array, and you cannot change the dimension of the array.
' The array has only one dimension, and the dimension is the last and only one, you can modify the size of the array.
Redim Preserve ly (countly)
Ly (countly) = Thisline
' Countly records the number of thisfile lines
countly = countly + 1
Loop
Thisfile.close

2: Start refreshing access to the current page IP address
Current system time stored in SJ
Sameip=0
For I=1 to (Countly-1)/2
' Get even sequence
' If the online IP address and the current time are more than one minute, then the IP
If DateDiff ("s", Ly (I*2), SJ) >60 Then
Ly (i*2-1) = ""
Ly (i*2) = ""
Countly=countly-2
End If

' Get the IP address just online, if it's still online
' Request.ServerVariables (' remote_addr ') gets the IP that emits the requesting machine
If Request.ServerVariables ("REMOTE_ADDR") =ly (i*2-1) Then
Sameip=1
Ly (i*2) =SJ
End If
Next

3: The latest access to the current page of the IP address deposit people.asp
' Start writing data to people.asp this file
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



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.