Copy codeThe Code is as follows: <%
'// Hittime date type: Get the last access time
'// Hits numeric type: obtains the total page views.
'// Hitsday numeric type: get today's page views
'// Hitsweeks numeric type: Get the page views of this week
'// Hitmonths numeric type: Get the page views this month
'Add these five fields to the database.
Set rs1 = server. CreateObject ("adodb. recordset ")
Rs1.open "select * from qwbmnewssss where id = 26", conn, 1, 3
If rs1.eof and rs1.bof then
Response. write "erry"
Else
Hittime = rs1 ("hittime") 'gets the last access time
Dim dayNow, monthNow, weeknow
DayNow = day (date () 'current number
MonthNow = month (date () 'current month
WeekNow = weekday (date () 'today, the day of the week 0 is Sunday
Rs1 ("hits") = rs1 ("hits") + 1' total browsing times + 1
If datediff ("d", hittime, now () = 0 then' compare the last access date with the current time day
Rs1 ("hitsday") = rs1 ("hitsday") + 1' today's views + 1
Else
Rs1 ("hitsday") = 1' today's views = 1
End if
If monthNow = month (hittime) then
Rs1 ("hitmonths") = rs1 ("hitmonths") + 1' views this month + 1
Else
Rs1 ("hitmonths") = 1' views this month + 1
End if
If datediff ("d", hittime, now ()> 6 then' has a problem during the week. if the last time is Friday, the next access is the Tuesday of the next week, record or overlay.
Rs1 ("hitsweeks") = 1
Else
If weekNow <> 1 then
Rs1 ("hitsweeks") = rs1 ("hitsweeks") + 1
Else
WeekNowss = weekday (hittime) 'last visit day of the week
If weekNow = weekNowss then
Rs1 ("hitsweeks") = rs1 ("hitsweeks") + 1
Else
Rs1 ("hitsweeks") = 1
End if
End if
End if
Rs1 ("hittime") = now () 'update the last access question
Rs1.update
%>
Time Comparison: <% = datediff ("d", hittime, now () %> <br/>
Current Time: <% = now () %> <br/>
Last Click Time: <% = hittime %> <br/>
Current day: <% = dayNow %> <br/>
Current month: <% = monthNow %> <br/>
Current week: <% = weekNow %> <br/>
Total page views: <% = rs1 ("hits") %> <br/>
Traffic Volume today: <% = rs1 ("hitsday") %> <br/>
Weekly Traffic: <% = rs1 ("hitsweeks") %> <br/>
Traffic Volume for the current month: <% = rs1 ("hitmonths") %> <br/>
<%
End if
Rs1.close
Set rs1 = nothing
%>