ServersPage Hit Counter System Page 3

Page Hit Counter System Page 3

ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.




The hit report page is straightforward. We basically loop thru
the hits table and display each  pages results and tally the
grand total for the 3 categories( daily, monthly and total). Since
we dont rotate all totals automatically we must check the hit_date
and todays date to verify if the month and day totals need to be
reported.

HIT<br /> COUNTER

Conn.Open(“web_odbc”)
Set RS = Conn.Execute(“SELECT * FROM
hits  ORDER BY total_hits DESC”)

total =
0       
Three variables to running totals

T_MONTH = 0
T_TODAY =
0

Do While NOT RS.EOF %>
td_dt =
now()

if datediff(“d”,RS(“last_dt”), td_dt) 0
then  ‘check to see if the hits are
todays

    todays_hits = 0  
‘hits not today so dont
include

else
   todays_hits =
RS(“today”)  ‘they were today so
include

end if
if datediff(“M”,RS(“last_dt”), td_dt)
0 then ‘ check to see if the hits are
this months

   MONTHS_hits =
0
else
   MONTHS_hits = RS(“MONTH”)
end if

%>

Loop

RS.Close
Conn.Close

set rs =
nothing
set conn = nothing
%>

PAGE
NAME
TOTAL
HITS
TODAY’S
HITS
THIS MONTHS
HITS
<a href="”>


           ‘print and add to running
totals




‘write out grand
totals

TOTAL PAGE HITS:

TOTAL HITS
TODAY:

TOTAL THIS
MONTH:

CURRENT ONLINE USERS :

HIGHEST NUMBER
OF SIMULTANEOUS CONNECTIONS:

Get the Free Newsletter!

Subscribe to Daily Tech Insider for top news, trends & analysis

Latest Posts

Related Stories