<%
'********************************
'官方网站:http://www.ztren.com
'E-mail:ishell@163.com
'发布日期:2009-11-17
'********************************

'页面执行时间
dim startime
startime=timer()

'数据库连接
Dim conn,connstr
on error resume next
connstr="DBQ="+server.mappath("#Date.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"'数据库连接地址
Set conn=Server.CreateObject("ADODB.CONNECTION")
conn.open connstr

'设置统计名称
dim Title
Title="非零坊『统计v3.3』"	'统计名称
%>
<html>
<head>
<title><% =Title %></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Content-Language" content="zh-cn">
<style>
body,td,th {
	/*文字大小*/
	font-size: 12px;
	/*文字颜色*/
	color: #2E2E2E;
	/*文字行距*/
	line-height: 20px;
}

a:link {
	text-decoration: none;
	color: #000000;
}

a:visited {
	text-decoration: none;
	color: #000000;
}

a:hover {
	color: #FF6600;
}
</style>
</head>
<body>
<%
Set mRs=Server.CreateObject("adodb.recordSet")
Sql="Select * from [Counter]"
mRs.open Sql,conn,1,1
%>
<table border="0" cellpadding="2" style="border-collapse: collapse" width="700" align="center" style="BORDER-RIGHT: #000000 1px dotted; BORDER-TOP: #000000 1px dotted; BORDER-LEFT: #000000 1px dotted; BORDER-BOTTOM: #000000 1px dotted;">
	<tr>
		<td width="90">总浏览量：</td>
		<td><% =mRs("Counter") %></td>
		<td width="75">最高浏览量：</td>
		<td width="230"><% =mRs("Top") %></td>
	</tr>
	<tr>
		<td colspan="4" style="BORDER-TOP: #000000 1px dotted; "></td>
	</tr>
	<tr>
		<td>总IP量：</td>
		<td><% =mRs("CounterIp") %></td>
		<td>最高IP量：</td>
		<td><% =mRs("TopIp") %></td>
	</tr>
	<tr>
		<td colspan="4" style="BORDER-TOP: #000000 1px dotted; "></td>
	</tr>
	<tr>
		<td>今日IP量：</td>
		<td><% =mRs("Today") %></td>
		<td>昨日IP量：</td>
		<td><% =mRs("YesterdayIp") %></td>
	</tr>
	<tr>
		<td colspan="4" style="BORDER-TOP: #000000 1px dotted; "></td>
	</tr>
	<tr>
		<td>今日浏览量：</td>
		<td><% =mRs("Browser") %></td>
		<td>昨日浏览量：</td>
		<td><% =mRs("Yesterday") %></td>
	</tr>
	<tr>
		<td colspan="4" style="BORDER-TOP: #000000 1px dotted; "></td>
	</tr>
	<tr>
		<td>平均日IP量：</td>
		<td><% =int(mRs("CounterIp")/mRs("Daynum")) %></td>
		<td>统计天数：</td>
		<td><% =mRs("Daynum") %></td>
	</tr>
	<tr>
		<td colspan="4" style="BORDER-TOP: #000000 1px dotted; "></td>
	</tr>
	<tr>
		<td>平均日浏览量：</td>
		<td><% =int(mRs("Counter")/mRs("Daynum")) %></td>
		<td></td>
		<td></td>
	</tr>
</table>
<table border="0" cellpadding="2" style="border-collapse: collapse" width="700" align="center" style="BORDER-RIGHT: #000000 1px dotted; BORDER-TOP: #000000 1px dotted; BORDER-LEFT: #000000 1px dotted; BORDER-BOTTOM: #000000 1px dotted;">
	<tr onmouseover="javascript:this.bgColor='#D5D5D5';" onmouseout="javascript:this.bgColor='';" align=center>
		<td>日期</td>
		<td>IP访问量</td>
		<td>浏览访问量</td>
	</tr>
	<%
	'修改下面的数字"7"可以改为任意天数
	Set mRs=Server.CreateObject("adodb.recordSet")
	Sql="Select top 7 * from [Day] order by Id desc"
	mRs.open Sql,conn,1,1
		If mRs.eof and mRs.bof then
			Response.Write "暂时没有往日统计记录"
		End If
	do while not mRs.eof
	%>
	<tr onmouseover="javascript:this.bgColor='#D5D5D5';" onmouseout="javascript:this.bgColor='';" align=center>
		<td><% =mRs("Zday") %></td>
		<td><font color="red"><% =mRs("Stats") %></font></td>
		<td><% =mRs("Browser") %></td>
	</tr>
	<% mRs.movenext
	loop
	mRs.close
	set mRs=nothing
	%>
</table>
<%
'显示今日最新IP,修改下面的数字"25"可以改为任意条数的IP
Set mRs=Server.CreateObject("adodb.recordSet")
Sql="Select top 25 * from [Ip] order by Id desc"
mRs.open sql,conn,1,1
If Not(mRs.eof and mRs.bof) then
	Response.Write"<table border=""0"" cellpadding=""2"" style=""border-collapse: collapse"" width=""700"" align=""center"" style=""BORDER-RIGHT: #000000 1px dotted; BORDER-TOP: #000000 1px dotted; BORDER-LEFT: #000000 1px dotted; BORDER-BOTTOM: #000000 1px dotted;"">"
For I = 1 to 10
	Response.Write "<tr>"
	For J=1 to 5
		Response.Write "<td><font color=""#000000"">"& mRs("Ip") &"</font></td>"
		mRs.movenext
		If mRs.eof then exit for
	Next
Response.Write "</tr>"
	If mRs.eof then exit for
Next
	Response.Write "</table>"
End If
mRs.close
set mRs=nothing
conn.close
set conn=nothing
%>
<table border="0" cellpadding="0" cellspacing="1" style="border-collapse: collapse" width="100%">
	<tr>
		<td height="5"></td>
	</tr>
	<tr>
		<td bgcolor="#FFFFFF" align="center">页面执行时间：<% =FormatNumber((timer()-startime)*1000,3) %>毫秒
		<br>Copyright &copy; 2009 <a href="http://www.ztren.com"><% =Title %></a> All Rights Reserved<br></td>
	</tr>
	<tr>
		<td align="center"><SCRIPT LANGUAGE="JavaScript" src="Counter.asp"></SCRIPT></td>
	</tr>
</table>
</body>
</html>