<%@ CODEPAGE = "936" %> <% '================================= ' ' 阿江酷站访问统计系统 ' Ajiang info@ajiang.net ' www.ajiang.net ' ' 版权所有·抄袭挪用必究 ' '================================= %> <% '权限检查 if session.Contents("master")=false and whatcan<2 then Response.Redirect "help.asp?id=004&error=您没有查看日访问统计的权限。" %> <%=countname%>-日访问统计

Tips: 用鼠标点指图形柱或者图形柱下的数字可以看到对应的访问量。


   ∷∷∷ 最近31天访问量 ∷∷∷
<% set conn=server.createobject("adodb.connection") DBPath = Server.MapPath(connpath) conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath '找到开始统计天数,如果天数不足31天,则跳过前面的空间 tmprs=conn.execute("Select top 1 vtime from view order by id") vfirst=tmprs("vtime") set tmprs=nothing if isnull(vfirst) then vfirst=now() vdays=int(date()-vfirst+1) '声明二维数组,voutday(*,0)为访问量,voutday(*,1)为日期,voutday(*,2)为星期 dim vday(31,3),voutday(31,3) maxday=0 sumday=0 for i=0 to 30 vday(i,0)=vdaycon(date()-30+i) if vday(i,0)>maxday then maxday=vday(i,0) sumday=sumday+vday(i,0) vday(i,1)=day(date()-30+i) vday(i,2)=weekday(date()-30+i) next '防止除数为0而出错 if maxday=0 then maxday=1 if sumday=0 then sumday=1 '根据已统计天数将数值左移 if vdays>=31 then for i=0 to 30 voutday(i,0)=vday(i,0) voutday(i,1)=vday(i,1) voutday(i,2)=vday(i,2) next else on error resume next for i=0 to 30 if i<=vdays then voutday(i,0)=vday(i+30-vdays,0) voutday(i,1)=vday(i+30-vdays,1) voutday(i,2)=vday(i+30-vdays,2) else voutday(i,0)=0 voutday(i,1)="" voutday(i,2)=0 end if next end if %> <% ' for i= 0 to 30 %> <% next %> <% for i= 0 to 30 %> <% next %>

<%=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%>

<%=voutday(i,1)%>日,访问<%=voutday(i,0)%>次,<%
	'计算访问量的百分数,精确到小数后1位,小于零的在前面加字母0
	lsbf=int(voutday(i,0)*1000/sumday+0.5)/10
	if lsbf<1 then lsbf=%">

0

%"><% '根据当天的日期用不同的颜色区分日期,周六用绿色,周日用红色 select case voutday(i,2) case 1%> <%case 7%> <%case else%> <%end select%> <%=voutday(i,1)%>

   ∷∷∷ 所有月份日访问量 ∷∷∷
<% Set rs = Server.CreateObject("ADODB.Recordset") sql="select vday,count(id) as allday from view group by vday" rs.Open sql,conn,1,1 dim vallday(31) maxallday=0 sumallday=0 do while not rs.EOF vallday(cint(rs("vday"))-1)=cint(rs("allday")) if vallday(cint(rs("vday"))-1)>maxallday then maxallday=vallday(cint(rs("vday"))-1) sumallday=sumallday+vallday(cint(rs("vday"))-1) rs.MoveNext loop '防止除数为0而出错 if maxallday=0 then maxallday=1 if sumallday=0 then sumallday=1 %> <% for i= 0 to 30 %> <% next %> <% for i= 0 to 30 %> <% next %>

<%=int(maxallday*10+0.5)/10%>

<%=int(3*maxallday*10/4+0.5)/10%>

<%=int(maxallday*10/2+0.5)/10%>

<%=int(maxallday*10/4+0.5)/10%>

<%=i+1%>日,访问<%=vallday(i)%>次,<%
	'计算访问量的百分数,精确到小数后1位,小于零的在前面加字母0
	lsbf=int(vallday(i)*1000/sumallday)/10
	if lsbf<1 then lsbf=%">

0

%"> <% '因为相邻的日期靠的太近,所以用隔一显示的办法 if (i+1) mod 2 then%> <%=i+1%><%end if%>
<% rs.Close set rs=nothing conn.Close set conn=nothing %>
<% '计算指定日期的访问量 function vdaycon(theday) theday=cdate(theday) thetday=cdate(theday+1) tmprs=conn.execute("Select count(id) as vdaycon from view where" & _ " vtime>=datevalue('" & theday & "') and vtime<=datevalue('" & thetday & "')") vdaycon=tmprs("vdaycon") set tmprs=nothing if isnull(vdaycon) then vdaycon=0 end function %>