Traffic | Statistics using ASP to write a simple daily flow, maximum daily flow statistics
-----------------------------------------------------------------------------
<%
' #########-statistics today, maximum daily flow-##########
Sub My_today_counter ()
Day1 = CStr (date ()) ' ######-get current date
Day_counter_file = Server.MapPath ("Counter/day_counter.ini") ' ######-Specify counter file
Set fo = Server.CreateObject ("Scripting.FileSystemObject")
Set get_old = fo. OpenTextFile (day_counter_file,1,false,false) ' ######-read record file
Day2 = Get_old. ReadLine
Today_counter = Get_old. ReadLine
Get_old.close
Application ("todays") = Today_counter
Set out = fo. CreateTextFile (Day_counter_file,true,false)
If day1 = Day2 Then ' #######-write today Traffic
Out. WriteLine (Day2)
Today_counter = Today_counter + 1
Out.writeline (Today_counter)
Out. Close
Else ' ######-a new day, summarizing maximum daily traffic
Max_day_counter_file = Server.MapPath ("Counter/max_day_counter.ini")
Set Outmax = fo. OpenTextFile (Max_day_counter_file,1,false,false)
Day3 = Outmax.readline
Maxdaycounter = Outmax.readline ' ######-read maximum daily traffic record
Outmax.close
Application ("maxday") = Maxdaycounter ' ######-maximum daily flow
If Today_counter-maxdaycounter>0 then ' ######-yesterday traffic is greater than maximum daily traffic record
Application ("maxday") = Today_counter ' ######-maximum daily flow
Set Outmax = Fo.createtextfile (max_day_counter_file,true,false)
Outmax.writeline (day2) ' ######-if Day2 has maximum daily flow
Outmax.writeline (today_counter) ' ######-write maximum daily traffic record
Outmax.close
End If
Out.writeline (day1) ' ######-Create a new day traffic statistics file
Today_counter = 1
Out. WriteLine (Today_counter)
Out. Close
End If
End Sub
Application.Lock ' Lock
My_today_counter ' Call procedure
Application.UnLock ' unlock lock
%>
<TD align=center class=big><a href= "Javascript:alert (' from May 1, 2001 to present, tomorrow net total traffic: <% =application (" counter ")% > Today: <%=application ("todays")%> busiest: <%=application ("Maxday")%> (passengers) ' onmouseover= ' window.status= ' Click to view traffic statistics information '; return true; "onmouseout=" window.status= "; return true; " > Flow Statistics </a>
===========================================================================
To ensure that the above program runs normally, you must first build two files under the directory/counter this file
(1) Day_counter.ine
File contents:
01-11-23
1
(2) Max_day_counter.ine
File contents:
01-11-22
1
<!--##########-01-11-23 is the server today's date-->