|
<%
set conn=server.createobject("adodb.connection")
DBPath = Server.MapPath(connpath)
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
'找到开始统计天数,如果天数不足7天,则跳过前面的空间
tmprs=conn.execute("Select first(vtime) as vfirst from view")
vfirst=tmprs("vfirst")
if isnull(vfirst) then vfirst=now()
vdays=int(date()-vfirst+1)
'声明二维数组,voutday(*,0)为访问量,voutday(*,1)为日期,voutday(*,2)为星期
dim vday(7,3),voutday(7,3)
maxday=0
sumday=0
for i=0 to 6
vday(i,0)=vdaycon(date()-6+i)
if vday(i,0)>maxday then maxday=vday(i,0)
sumday=sumday+vday(i,0)
vday(i,1)=day(date()-6+i)
vday(i,2)=weekday(date()-6+i)
next
'防止除数为0而出错
if maxday=0 then maxday=1
if sumday=0 then sumday=1
'根据已统计天数将数值左移
if vdays>=7 then
for i=0 to 6
voutday(i,0)=vday(i,0)
voutday(i,1)=vday(i,1)
voutday(i,2)=vday(i,2)
next
else
for i=0 to 6
if i<=vdays then
voutday(i,0)=vday(i+6-vdays,0)
voutday(i,1)=vday(i+6-vdays,1)
voutday(i,2)=vday(i+6-vdays,2)
else
voutday(i,0)=0
voutday(i,1)=""
voutday(i,2)=0
end if
next
end if
%>
<%=int(maxday*10+0.5)/10%>
<%=int(3*maxday*10/4+0.5)/10%>
<%=int(maxday*10/2+0.5)/10%>
<%=int(maxday*10/4+0.5)/10%>
|
|
<%
for i= 0 to 6
%>
%"> |
<%
next
%>
|
|
0 |
|
<%
for i= 0 to 6
%>
%"><%
'根据当天的日期用不同的颜色区分日期,周六用绿色,周日用红色
select case voutday(i,2)
case 1%>
<%case 7%>
<%case else%>
<%end select%>
<%=findweek(voutday(i,2))%> |
<%
next
%>
|
|
|
|
|
<%
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select vweek,count(id) as allweek from view group by vweek"
rs.Open sql,conn,1,1
dim vallweek(7)
maxallweek=0
sumallweek=0
do while not rs.EOF
vallweek(cint(rs("vweek"))-1)=cint(rs("allweek"))
if vallweek(cint(rs("vweek"))-1)>maxallweek then maxallweek=vallweek(cint(rs("vweek"))-1)
sumallweek=sumallweek+vallweek(cint(rs("vweek"))-1)
rs.MoveNext
loop
'防止除数为0而出错
if maxallweek=0 then maxallweek=1
if sumallweek=0 then sumallweek=1
%>
<%=int(maxallweek*10+0.5)/10%>
<%=int(3*maxallweek*10/4+0.5)/10%>
<%=int(maxallweek*10/2+0.5)/10%>
<%=int(maxallweek*10/4+0.5)/10%>
|
|
<%
for i= 0 to 6
%>
%"> |
<%
next
%>
|
|
0 |
|
<%
for i= 0 to 6
%>
%">
<%=findweek(i+1)%> |
<%
next
%>
|
|
|
|