<!-- #INCLUDE FILE = "conn.asp" -->
<!-- #INCLUDE FILE = "date.asp" -->
<!-- #INCLUDE FILE = "session.asp" -->
<%
dim Rs,sql
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Untitled Document</title>
<link href="style/css.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
.style2 {
	color: #cc3300;
	font-weight: bold;
}
.style3 {
	color: #006699;
	font-weight: bold;
}
.style4 {
	color: #000000;
	font-weight: bold;
}
-->
</style>
</head>

<body>
<p><br />
  &nbsp;&nbsp;<span class="style3">摘要：</span><span class="style2"><%=strDate%></span></p>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000" class="line20">
  <tr>
    <td width="36%" height="20" bgcolor="#006699">&nbsp;</td>
    <td width="64%" bgcolor="#006699"><div align="center" class="style1">页面显示</div></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><span class="style4">今日：</span></td>
    <td bgcolor="#FFFFFF" class="paddleft10">
	<%	
	Set Rs=Server.CreateObject("ADODB.Recordset")
	If databaseType = 1 Then
		sql= "SELECT f_hits FROM t_daily WHERE f_date=#"&strDate&"#"
	Else
		sql = "SELECT f_hits FROM t_daily WHERE CONVERT(varchar(10),f_date,121) = '"&strDate&"'"
	End If
	Rs.open sql,conn,3,1
	if not rs.eof and not rs.bof then
		response.Write(rs(0))
	end if
	Rs.close
	set Rs=nothing
	%>	</td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>每天平均<span class="style4">：</span></strong></td>
    <td bgcolor="#FFFFFF" class="paddleft10">
	<%
	dim dayAverage,dailyTotal,dailyHitsTotal
	Set Rs=Server.CreateObject("ADODB.Recordset")
	sql= "SELECT count(*),sum(f_hits) FROM t_daily"	
	Rs.open sql,conn,3,1
	if not rs.eof and not rs.bof then
		dailyTotal=rs(0)
		dailyHitsTotal=rs(1)
		if dailyTotal=0 then		
			dayAverage=0
		else
			dayAverage=FormatNumber(dailyHitsTotal/dailyTotal, 1)
		end if
	end if
	Rs.close
	set Rs=nothing
	response.Write(dayAverage)
	%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>最后一周<span class="style4">：</span></strong></td>
    <td bgcolor="#FFFFFF" class="paddleft10"><%
	dim weekCount
	Set Rs=Server.CreateObject("ADODB.Recordset")
	if(databaseType=1) then
		sql= "SELECT sum(f_hits) FROM t_daily where dateDiff('d','"&strDate&"',f_date)<=7"
	else
		sql= "SELECT sum(f_hits) FROM t_daily where dateDiff(d,'"&strDate&"',f_date)<=7"
	end if
	Rs.open sql,conn,3,1
	if not rs.eof and not rs.bof then		
		weekCount=rs(0)
	end if
	Rs.close
	set Rs=nothing
	response.Write(weekCount)
	%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>本月<span class="style4">：</span></strong></td>
    <td bgcolor="#FFFFFF" class="paddleft10">
	<%
	dim monthCount
	Set Rs=Server.CreateObject("ADODB.Recordset")
	if(databaseType=1) then
		sql= "SELECT sum(f_hits) FROM t_daily where dateDiff('d','"&strDate&"',f_date)<=31"
	else
		sql= "SELECT sum(f_hits) FROM t_daily where dateDiff(d,'"&strDate&"',f_date)<=31"
	end if
	Rs.open sql,conn,3,1
	if not rs.eof and not rs.bof then		
		monthCount=rs(0)
	end if
	Rs.close
	set Rs=nothing
	response.Write(monthCount)
	%></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><strong>总计</strong><span class="style4">：</span></td>
    <td bgcolor="#FFFFFF" class="paddleft10">
	<%
	dim totalIp,totalPv
	Set Rs=Server.CreateObject("ADODB.Recordset")
	sql= "SELECT f_totalip,f_totalpv from t_global"	
	Rs.open sql,conn,3,1
	if not rs.eof and not rs.bof then
		rs.movefirst	
		totalIp=rs(0)
		totalPv=rs(1)
	end if
	Rs.close
	set Rs=nothing
	response.Write("独立IP:"&totalIp&" 页面PV:"&totalPv&" 最新缓存:"&application("statNum"))
	%>
	</td>
  </tr>
</table>
<br />
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000">
  <tr>
    <td height="20" bgcolor="#006699"><div align="center" class="style1">最近7天统计</div></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
	  <%
	  	dim w_hits,w_week,w_total,imgHeight
		Set Rs=Server.CreateObject("ADODB.Recordset")
		if(databaseType=1) then
			w_total=conn.execute("SELECT sum(f_hits) FROM t_daily where dateDiff('d',f_date,'"&strDate&"')<7 and dateDiff('d',f_date,'"&strDate&"')>=0")(0)
		else
			w_total=conn.execute("SELECT sum(f_hits) FROM t_daily where dateDiff(d,f_date,'"&strDate&"')<7 and dateDiff(d,f_date,'"&strDate&"')>=0")(0)
		end if
		if(w_total<=0) then
			w_total=1
		end if
		if(databaseType=1) then
			sql= "SELECT top 7 f_hits,f_week,f_date FROM t_daily where dateDiff('d',f_date,'"&strDate&"')>=0 and dateDiff('d',f_date,'"&strDate&"')<7 order by f_date asc"
		else
			sql= "SELECT top 7 f_hits,f_week,f_date FROM t_daily where dateDiff(d,f_date,'"&strDate&"')>=0 and dateDiff(d,f_date,'"&strDate&"')<7 order by f_date asc"
		end if
		Rs.open sql,conn,3,1
		while not rs.eof
			w_hits=rs(0)
			w_week=rs(1)			
			imgHeight=formatnumber(w_hits/w_total,2)*100
	  %>
        <td valign="bottom"><div align="center"><%=w_hits%><br />
<img src="images/green.gif" width="10" height="<%=imgHeight%>" /><br />
星期<%=w_week%>:<%=rs(2)%></div>
		</td>
	  <%
	 	 Rs.movenext
	  wend
	  Rs.close
	  set Rs=nothing
	  %>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
<%
call connclose()
%>