ASP displays the number of current pages online and IP address

Source: Internet
Author: User
Tags array current time servervariables access
IP Address | web | show | online | number

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 current time in the statistics just now exceed 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
  if request.servervariables ("REMOTE_ADDR") =ly (i*2-1) then
  sameip=1
that issued the requesting machine   ly (i*2) =SJ
  end if
  next
  
   3: Save the latest IP address for the current page to 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



Related Article

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.