<%@ 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: 用鼠标点指图形柱或者图形柱下的数字可以看到对应的访问量。


   ∷∷∷ 最近12个月访问量 ∷∷∷
<% set conn=server.createobject("adodb.connection") DBPath = Server.MapPath(connpath) conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath %> <% Set rs = Server.CreateObject("ADODB.Recordset") '计算12个月(零头也算一个月)前的时间 datetwelve=dateadd("m",-11,date()) datetwelve=cdate(year(datetwelve) & "-" & month(datetwelve) & "-1") sql="select vmonth,count(id) as allmonth from view where vtime>=datevalue('" & _ datetwelve & "') group by vmonth" rs.Open sql,conn,1,1 dim vallmonth(12) maxallmonth=0 sumallmonth=0 do while not rs.EOF vallmonth(cint(rs("vmonth"))-1)=cint(rs("allmonth")) if vallmonth(cint(rs("vmonth"))-1)>maxallmonth then maxallmonth=vallmonth(cint(rs("vmonth"))-1) sumallmonth=sumallmonth+vallmonth(cint(rs("vmonth"))-1) rs.MoveNext loop '防止除数为零而出错 if maxallmonth=0 then maxallmonth=1 if sumallmonth=0 then sumallmonth=1 %> <% for i= 0 to 11 themonth=month(now())+i if themonth>11 then themonth=themonth-12 %> <% next %> <% for i= 0 to 11 themonth=month(now())+i if themonth>11 then themonth=themonth-12 %> <% next %>

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

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

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

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

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

0

%"> <%=themonth+1%>
<% rs.Close %>
   ∷∷∷ 所有12个月访问量 ∷∷∷
<% sql="select vmonth,count(id) as allmonth from view group by vmonth" rs.Open sql,conn,1,1 for i=0 to 11 vallmonth(i)=0 next maxallmonth=0 sumallmonth=0 do while not rs.EOF vallmonth(cint(rs("vmonth"))-1)=cint(rs("allmonth")) if vallmonth(cint(rs("vmonth"))-1)>maxallmonth then maxallmonth=vallmonth(cint(rs("vmonth"))-1) sumallmonth=sumallmonth+vallmonth(cint(rs("vmonth"))-1) rs.MoveNext loop '防止除数为零而出错 if maxallmonth=0 then maxallmonth=1 if sumallmonth=0 then sumallmonth=1 %> <% for i= 0 to 11 themonth=i %> <% next %> <% for i= 0 to 11 themonth=i %> <% next %>

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

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

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

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

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

0

%"> <%=themonth+1%>
<% rs.Close %>
   ∷∷∷ 年访问量统计 ∷∷∷
<% sql="select vyear,count(id) as allyear from view group by vyear order by vyear DESC" rs.Open sql,conn,1,1 maxallyear=0 sumallyear=0 do while not rs.EOF if cint(rs("allyear"))>maxallyear then maxallyear=cint(rs("allyear")) sumallyear=sumallyear+cint(rs("allyear")) rs.MoveNext loop '防止除数为零而出错 if maxallyear=0 then maxallyear=1 if sumallyear=0 then sumallyear=1 rs.MoveFirst do while not rs.EOF theyear=rs("vyear") vallyear=rs("allyear") %> <% rs.MoveNext loop %>
%"><%=theyear%>  <%=theyear%>年,访问<%=vallyear%>次,<%
	'计算访问量的百分数,精确到小数后1位,小于零的在前面加字母0
	lsbf=int(vallyear*1000/sumallyear)/10
	if lsbf<1 then lsbf=%"> <%=vallyear%>
<% rs.Close set rs=nothing conn.Close set conn=nothing %>