<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "provider=microsoft.jet.oledb.4.0;data Source=D:\web\localuser\uniartrelogios\www\db\hit_counter.mdb;" & ""
Set RSrich = Server.CreateObject("ADODB.Recordset")
'Count all visits in the database
RSrich.Open "SELECT COUNT (*) AS TotalVisits FROM Hits", conn, 3, 3
If Not RSrich.Eof and NOT RSrich.Bof Then
'Store the total number of visits in TotalVisited Varable
TotalVisits = RSrich("TotalVisits")
RSrich.Close
response.write "
Total de visitas : " & TotalVisits & "
"
End If
'Count all by most often visit
Query = "SELECT * FROM Hits"
RSrich.Open Query, conn, 3, 3
If Not RSrich.Eof and NOT RSrich.Bof Then
alldata=RSrich.getrows
RSrich.Close
numcols=ubound(alldata,1)
numrows=ubound(alldata,2)
hit_date=1
hit_time=2
hit_ip=3
hit_referer=4
hit_agent=5
' if you want to show table change to true table nice for trouble shooting
show_full = false
if show_full = true then
response.write "
" & vbcrlf
'Put Headings On The Table of Field Names
for each whatever in RSrich.fields
response.write "| " & whatever.name & " | " & vbcrlf
next
response.write "
" & vbcrlf
FOR rowcounter= 0 TO numrows
response.write "" & vbcrlf
FOR colcounter=0 to numcols
thisfield=alldata(colcounter,rowcounter)
if isnull(thisfield) then
thisfield=shownull
end if
if trim(thisfield)="" then
thisfield=showblank
end if
response.write "| "
response.write thisfield
response.write " | " & vbcrlf
NEXT
response.write "
" & vbcrlf
NEXT
response.write "
"
end if ' end of pring all loop
dim date_on
dim date_count
dim days
dim time_count(30)
date_on = alldata(hit_date,0) 'start date
date_count = 0
days = 1
response.write "
Visitas por ip's pela data
"
FOR rowcounter= 0 TO numrows
' response.write "date_on = " & date_on & " date_row " & alldata(hit_date,rowcounter) & "
"
if date_on = alldata(hit_date,rowcounter) then
date_count = date_count + 1
else
response.write "
em " & alldata(hit_date,rowcounter) & " havia " & date_count & " visitantes"
date_count = 1
date_on = alldata(hit_date,rowcounter)
days = days + 1
end if
next
response.write "
Total de " & days & " dias em Banco de dados"
response.write "
Visitas de média por dia " & TotalVisits/days & ""
FOR rowcounter = 0 TO numrows
' response.write hour(alldata(hit_time,rowcounter)) & " hour for " & alldata(hit_time,rowcounter) & "
"
for time_loop = 0 to 23
if (hour(alldata(hit_time,rowcounter)) >= time_loop ) and (hour(alldata(hit_time,rowcounter)) < (time_loop + 1) ) then
time_count(time_loop) = time_count(time_loop) + 1
end if
next
next
response.write "
Visitas antes de hora 0 ser 12 é a 23 ser 11 pm
"
response.write "
"
for t_loop = 0 to 23
if (t_loop = 6) or (t_loop = 12) or (t_loop = 18) then
response.write "
"
end if
response.write "| Às " & t_loop & " horas " & time_count(t_loop) & " visitas | "
next
response.write "
"
end if 'end all loops
conn.close
%>