<%
'乘风多用户计数器 Sql版
'作者QQ：178575
'作者EMail：yliangcf@163.com
'作者网站：http://www.qqcf.com
'详细简介：http://www.qqcf.com/cfcount.htm
'上面有程序在线演示，安装演示，使用疑难解答，最新版本下载等内容
'因为这些内容可能时常更新，就没有放在程序里，请自己上网站上查看
'有完整版本的演示
%>
<%
UserName=ChkStr(Request.QueryString("UserName"),1)
If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" Then
 Ip = ChkStr(Request.ServerVariables("REMOTE_ADDR"),1)
Else
 Ip = ChkStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"),1)
End If

Set RsUser= Server.CreateObject("Adodb.RecordSet")
Sql="Select * From CFCount_User Where UserName='"&UserName&"'"
RsUser.Open Sql,Conn,1,1
%>

<script>
function userlogincheck()
{
  if(window.document.form_view.pwd_view.value=="")
  {
     alert("请输入独立查看密码!");
	 window.document.form_view.pwd_view.focus();
	 return false;
  }
 return true;
}

</script>

  <form name="form_view" id="form_view" method="post" action="?Action=viewuserlogin&UserName=<%=UserName%>" onsubmit="return userlogincheck();">
<table class="tb_2">
  <tr class="tr_1"> 
    <td><a href="Index.asp?UserName=<%=Username%>">[<%=RsUser("PageName")%>] 的站长请点击这里登录</a></td>
  </tr>
  <tr> 
      <td class="td_2">独立查看密码： 
          <input name="pwd_view" type="password" id="pwd_view">
<INPUT type=image border=0 name=imageField src="images/login.gif" style="width:53px;height:21px;border:0px;">
      </td>
    </tr>  
</table></form>


<%If RsUser("GbookState")=-1 Then%>
<script>
function gbookcheck(){
 if(document.gbook_form.content.value==""||document.gbook_form.content.value=="请输入留言内容"){
  alert("请输入留言内容!");
  document.gbook_form.content.focus();
  return false;
 }
 if(document.gbook_form.contact.value==""||document.gbook_form.contact.value=="请输入联系方式"){
  alert("请输入联系方式!");
  document.gbook_form.contact.focus();
  return false;
 }
 
document.gbook_form.submit();
}
</script>

  <form name="gbook_form" method="post" action="CF.aspx?Action=gbookaddsave&UserName=<%=UserName%>" target="_blank">
<table class="tb_2"><tr class="tr_1"> 
      <td>给[<%=RsUser("PageName")%>]站长留言</td>
    </tr>
	<tr class="tr_2"> 
      <td>留言内容：<br /> 
<textarea name='content' id='content' cols='22' rows='8' style="overflow:auto;border: 1px solid;" onmouseover="if(document.getElementById('content').value=='请输入留言内容')document.getElementById('content').value='';" onmouseout="if(document.getElementById('content').value=='')document.getElementById('content').value='请输入留言内容';">请输入留言内容</textarea>
      </td>
	</tr>
		<tr class="tr_2"> 
      <td>联系方式：<br /> 
<textarea name='contact' id='contact' cols='22' rows='6' style="overflow:auto;border: 1px solid;" onmouseover="if(document.getElementById('contact').value=='请输入联系方式')document.getElementById('contact').value='';" onmouseout="if(document.getElementById('contact').value=='')document.getElementById('contact').value='请输入联系方式';">请输入联系方式</textarea>
        </td>
    </tr>
		<tr class="tr_2"> 
      <td><span style="cursor:hand"><img src='images/gbook_send.gif' onclick="gbookcheck()" ></span>
        </td>
    </tr>
</table></form>
<%End If%> 

<%If RsUser("TjOpen")=-1 Then'统计开放时%>

<%If RsUser("SurveyOpen")=-1 Then%>
		
<%
BzksDate=date
if weekday(BzksDate)=1 then BzksDate=DateAdd("d", -6, BzksDate)
if weekday(BzksDate)=2 then BzksDate=BzksDate
if weekday(BzksDate)=3 then BzksDate=DateAdd("d", -1, BzksDate)
if weekday(BzksDate)=4 then BzksDate=DateAdd("d", -2, BzksDate)
if weekday(BzksDate)=5 then BzksDate=DateAdd("d", -3, BzksDate)
if weekday(BzksDate)=6 then BzksDate=DateAdd("d", -4, BzksDate)
if weekday(BzksDate)=7 then BzksDate=DateAdd("d", -5, BzksDate)

SzmDate=DateAdd("d", -1, BzksDate)
SzksDate=DateAdd("d", -7, BzksDate)

SyDate=dateadd("m",-1,cdate(year(now)&"-"&month(now)&"-1"))

Sql="CFCount_TjSurvey_Proc '"&UserName&"','"&BzksDate &"','"&SzksDate&"','"&SzmDate&"','"&SyDate&"'"
Set Rs=Conn.Execute(Sql)
%>

<table class="tb_2 tb_u">
<tr class="tr_1">
    <td colspan="4"> 统计概况</td>
  </tr>
 <tr>
    <td>统计账号：</td>
    <td colspan="3">
	<%
	If Rs("VipState")=-1 Then
	 If Rs("ParentName")="" Then
	  Response.Write "<font color=ff0000>Vip父账号</font>&nbsp;Vip到期时间："&Rs("VipEndDate")&"&nbsp;允许子账号数:"&Rs("VipAddSubNum")
	 Else
	  Response.Write "<font color=ff0000>Vip子账号</font>&nbsp;Vip到期时间："&Rs("VipEndDate")
	 End If
	ElseIf Rs("VipState")=0 Then
	 If Rs("ParentName")="" Then
	  Response.Write "普通父账号"
	  If RsSet("UserUseDayState")=-1 Then 
	   Response.Write "&nbsp;到期时间："&Rs("EndDate")
	  Else
	   Response.Write "&nbsp;永久使用"
	  End If
	  Response.write "&nbsp;允许子账号数:"&RsSet("UserAddSubNum")	  
	 Else
	  Response.Write "普通子账号"
	  If RsSet("UserUseDayState")=-1 Then 
	   Response.Write "&nbsp;到期时间："&Rs("EndDate")
	  Else
	   Response.Write "&nbsp;永久使用"
	  End If
	 End If
	End If
	 %>
	</td>
  </tr>
  <tr> 
    <td>网站名称：</td>
    <td colspan="3"><b><%=Rs("PageName")%></b></td>
  </tr>
  <tr> 
    <td>站点地址：</td>
    <td colspan="3"><a href="<%=Rs("PageUrl")%>" target="_blank"><%=Rs("PageUrl")%></a>&nbsp;[<a href="http://www.alexa.com/data/details/traffic_details?q=&url=<%=RsUser("PageUrl")%>" target="_blank">Alexa排名查询</a>]&nbsp;[<a href="http://web.archive.org/web/*/<%=RsUser("PageUrl")%>" target="_blank">历史网页回忆</a>]</td>
  </tr>
  <tr> 
    <td>开始统计于：</td>
    <td colspan="3"><%=Rs("AddTime")%></td>
  </tr>
  <tr> 
    <td>已统计天数：</td>
    <td colspan="3"><%=DateDiff("d",Rs("AddTime"),Now())%>天</td>
  </tr>
  <tr> 
    <td>平均每人访问页数：</td>
    <td colspan="3"><%=Int(Rs("RealShowTotal")/Rs("RealIpTotal"))%>页</td>
  </tr>
  <tr> 
    <td>在线人数：</td>
    <td colspan="3"><%=Rs("OnlineTotal")%></td>
  </tr>
  <tr> 
    <td></td>
    <td>浏览量 </td>
    <td>访问量 </td>
    <td></td>
  </tr>
  <tr> 
    <td>总量：</td>
    <td><%=Rs("RealShowTotal")%></td>
    <td><%=Rs("RealIpTotal")%></td>
    <td></td>
  </tr>
  <tr> 
    <td>今日流量：</td>
    <td><%=Rs("TodayShow")%></td>
    <td><%=Rs("TodayIp")%></td>
    <td> 今天最高： <%=Rs("TodayTopIp")%> IP (发生在: <%=Rs("TodayTopIpTime")%>时) 最低： <%=Rs("TodayLowIp")%> IP (发生在: <%=Rs("TodayLowIpTime")%>时)</td>
  </tr>
  <tr> 
    <td>昨日流量：</td>
    <td><%=Rs("YesShow")%></td>
    <td><%=Rs("YesIp")%></td>
    <td> 昨天最高： <%=Rs("YesTopIp")%> IP (发生在: <%=Rs("YesTopIpTime")%>时) 最低： <%=Rs("YesLowIp")%> IP (发生在: <%=Rs("YesLowIpTime")%>时)</td>
  </tr>
  <%
BzksDate=date
if weekday(BzksDate)=1 then BzksDate=DateAdd("d", -6, BzksDate)
if weekday(BzksDate)=2 then BzksDate=BzksDate
if weekday(BzksDate)=3 then BzksDate=DateAdd("d", -1, BzksDate)
if weekday(BzksDate)=4 then BzksDate=DateAdd("d", -2, BzksDate)
if weekday(BzksDate)=5 then BzksDate=DateAdd("d", -3, BzksDate)
if weekday(BzksDate)=6 then BzksDate=DateAdd("d", -4, BzksDate)
if weekday(BzksDate)=7 then BzksDate=DateAdd("d", -5, BzksDate)

SzmDate=DateAdd("d", -1, BzksDate)
SzksDate=DateAdd("d", -7, BzksDate)

%>
  <tr> 
    <td>本周累计：</td>
    <td><%=Rs("TWeekShow")%></td>
    <td><%=Rs("TWeekIp")%></td>
    <td> 本周最高： <%=Rs("TWeekTopIp")%> IP (发生在: <%=Rs("TWeekTopIpTime")%>) 最低： <%=Rs("TWeekLowIp")%> IP (发生在: <%=Rs("TWeekLowIpTime")%>)</td>
  </tr>
  <tr> 
    <td>上周累计：</td>
    <td><%=Rs("YWeekShow")%></td>
    <td><%=Rs("YWeekIp")%></td>
    <td> 上周最高： <%=Rs("YWeekTopIp")%> IP (发生在: <%=Rs("YWeekTopIpTime")%>) 最低： <%=Rs("YWeekLowIp")%> IP (发生在: <%=Rs("YWeekLowIpTime")%>)</td>
  </tr>
  <tr> 
    <td>本月累计：</td>
    <td><%=Rs("TMonthShow")%></td>
    <td><%=Rs("TMonthIp")%></td>
    <td> 本月最高： <%=Rs("TMonthTopIp")%> IP (发生在: <%=Rs("TMonthTopIpTime")%>) 最低： <%=Rs("TMonthLowIp")%> IP (发生在: <%=Rs("TMonthLowIpTime")%>)</td>
  </tr>
  <tr> 
    <td>上月累计：</td>
    <td><%=Rs("YMonthShow")%></td>
    <td><%=Rs("YMonthIp")%></td>
    <td> 上月最高： <%=Rs("YMonthTopIp")%> IP (发生在: <%=Rs("YMonthTopIpTime")%>) 最低： <%=Rs("YMonthLowIp")%> IP (发生在: <%=Rs("YMonthLowIpTime")%>)</td>
  </tr>
  <tr> 
    <td>今年累计：</td>
    <td><%=Rs("TYearShow")%></td>
    <td><%=Rs("TYearIp")%></td>
    <td> 所有最高： <%=Rs("TYearTopIp")%> IP (发生在: <%=Rs("TYearTopIpTime")%>) 最低： <%=Rs("TYearLowIp")%> IP (发生在: <%=Rs("TYearLowIpTime")%>)</td>
  </tr>
  <tr> 
    <td>平均每日：</td>
    <td><%=Int(Rs("RealShowTotal")/DateDiff("d",Rs("AddTime"),Now())+1)%></td>
    <td><%=Int(Rs("RealIpTotal")/DateDiff("d",Rs("AddTime"),Now())+1)%></td>
    <td></td>
  </tr>
  <tr> 
    <td>预计今日：</td>
    <td> 
        <%
			MyTime=DateDiff("n",Date(),Now())
			If MyTime=0 Then MyTime=1
			Response.write Int(Rs("TodayShow")*1440/MyTime)
			%>
    </td>
    <td> 
        <%Response.write Int(Rs("TodayIp")*1440/MyTime)%>
    </td>
    <td>&nbsp;</td>
  </tr>
</table>
<%End If%>

<%If RsUser("TodayLyOpen")=-1 Then%><br>
<%
Sql="Select Top 100 * From CFCount_Online where UserName='"&UserName&"'"
Sql=Sql&" Order By AddTime Desc"

Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.open Sql,Conn,1,1
%>
<table class="tb_2 tb_u">
<tr class="tr_1">
<td colspan="9">最近100个访问记录</td>
</tr>
<tr class="tr_2">
 <td class="td_nowrap">IP</td>
 <td class="td_nowrap">PV数量</td>
 <td class="td_nowrap">屏幕分辨率</td>
 <td class="td_nowrap">屏幕色彩</td>
 <td class="td_nowrap">操作系统</td>
 <td class="td_nowrap">浏览器</td>
 <td class="td_nowrap">开始访问时间</td>
 <td class="td_nowrap">最后访问时间</td>
 <td class="td_nowrap">停留时间</td>
 </tr>

<%
While Not Rs.Eof
%>
<tr class="tr_2">
    <td class="td_nowrap">
        <%If Ip=Rs("Ip") Then Response.Write "<font color=ff0000>"%>
        <%=Rs("Ip")%> 
        <%If Ip=Rs("Ip") Then Response.Write "</font>"%>
        <%
		If Rs("Area")<>"" Then
		 Response.Write "<br>"&Rs("Area")&Rs("Area_2")&Rs("Area_3")
		End If
		 %>
		</td>
    <td class="td_nowrap"><%=Rs("PvTotal")%></td>
    <td class="td_nowrap"><%=Rs("ScreenWidth")%>×<%=Rs("ScreenHeight")%></td>
    <td class="td_nowrap"><%=Rs("ScreenColorDepth")%></td>
    <td class="td_nowrap"><%=Rs("OsType")%></td>
    <td class="td_nowrap"><%=Rs("BrowserType")%></td>
    <td class="td_nowrap"><%=Rs("AddTime")%></td>
    <td class="td_nowrap"><%=Rs("LastTime")%></td>
	<td class="td_nowrap"><%=DateDiff("n",Rs("AddTime"),Rs("LastTime"))%>分钟</td>
  </tr>
<tr>
<td colspan="9" width="970px" style="word-wrap: break-word;word-break:break-all;"><a href="?Action=<%=Action%>&Px=Ly">来源</a>：<a href="?Action=urlgo&Url=<%=Server.URLEncode(Rs("Ly"))%>" target="_blank"><%=server.HTMLEncode(Rs("Ly"))%></a></td>
</tr>
<tr>
<td colspan="9" width="970px" style="word-wrap: break-word;word-break:break-all;"><a href="?Action=<%=Action%>&Px=Currweb">受访页</a>：<a href="?Action=urlgo&Url=<%=Server.URLEncode(Rs("Currweb"))%>" target="_blank"><%=server.HTMLEncode(Rs("Currweb"))%></a></td>
</tr>
  <%rs.movenext

wend%>

</table>

        <br>

<table class="tb_2 tb_u">

<%
Sql="Select Sum(MyCounter),Sum(IpCounter) From CFCount_Ly_Day where UserName='"&UserName&"' And Datediff(d,AddDate,Getdate())=0"
Set Rs=Conn.execute(Sql)
ShowTotal=Rs(0)
IpTotal=Rs(1)

Sql="Select Top 20 * From CFCount_Ly_Day where UserName='"&UserName&"' And Datediff(d,AddDate,Getdate())=0"
Sql=Sql&" Order By IpCounter Desc"
Set Rs=Conn.execute(Sql)
%>
<tr class="tr_1">
            <td colspan="9"><%=Date()%> 来源日统计[可点击标题排序]</td>
  </tr>
          <tr> 
            <td><a href="?Action=<%=Action%>&AddDate=<%=AddDate%>&Px=ID">序号</a></td>
            <td><a href="?Action=<%=Action%>&AddDate=<%=AddDate%>&Px=LyHead">来源网站</a></td>
            <td colspan="2"><a href="?Action=<%=Action%>&AddDate=<%=AddDate%>&Px=MyCounter">PV数量</a></td>
            <td colspan="2"><a href="?Action=<%=Action%>&AddDate=<%=AddDate%>&Px=IPCounter">IP数量</a></td>
            <td><a href="?Action=<%=Action%>&AddDate=<%=AddDate%>&Px=AddTime">上站时间</a></td>
            <td><a href="?Action=<%=Action%>&AddDate=<%=AddDate%>&Px=Ip">最后IP地址</a></td>
            <td><a href="?Action=<%=Action%>&AddDate=<%=AddDate%>&Px=LastTime">最后访问时间</a></td>
          </tr>
<%
I=1
While Not Rs.Eof And I<20
%>
          <tr> 
            <td class="td_1"><%=I%></td>
            <td class="td_1"> 
                <%If Rs("LyHead")="" Then
  Response.Write "直接从浏览器输入"
 Else
  Response.Write "<a href='http://"&Rs("LyHead")&"' target='_blank'>"&server.HTMLEncode(Rs("LyHead"))&"</a>&nbsp;[<a href="&Rs("Ly")&" target='_blank'>详细</a>]"
 End If%>
            </td>
            <td class="td_1"><%=Rs("MyCounter")%></td>
            <td class="td_1"><img src=images/bar_blue.gif width=<%=CInt(Rs("MyCounter")/ShowTotal*80)%> height=10><%=MyRate(Rs("MyCounter"),ShowTotal)%>%</td>
            <td class="td_1"><%=Rs("IpCounter")%></td>
            <td class="td_1"><img src=images/bar_green.gif width=<%=CInt(Rs("IpCounter")/IpTotal*80)%> height=10><%=MyRate(Rs("IpCounter"),IpTotal)%>%</td>
            <td class="td_1"><%=GetTurnTime(Hour(Rs("AddTime")))&":"&GetTurnTime(Minute(Rs("AddTime")))&":"&GetTurnTime(Second(Rs("AddTime")))%></td>
            <td class="td_1"> 
                <%If Ip=Rs("Ip") Then Response.Write "<font color=ff0000>"%>
                <%=Rs("Ip")%> 
                <%If Ip=Rs("Ip") Then Response.Write "</font>"%>
            </td>
            <td class="td_1"><%=GetTurnTime(Hour(Rs("LastTime")))&":"&GetTurnTime(Minute(Rs("LastTime")))&":"&GetTurnTime(Second(Rs("LastTime")))%></td>
          </tr>
          <%rs.movenext
		  I=I+1
wend%>
</table>

<%End If%>

<%If RsUser("OnlineOpen")=-1 Then%><br>
<%
Px=ChkStr(Request("Px"),1)
If Px="" Then Px="LastTime"
Call PxFilter(Px,"Ip,PvTotal,VisitTotal,Ly,Currweb,AddTime,LastTime,ScreenWidth,ScreenHeight,ScreenColorDepth,OsType,BrowserType")


Sql="Select Count(ID) From CFCount_Online where UserName='"&UserName&"' And Datediff(n,AddTime,Getdate())<="&OnlineTime
Set Rs=Conn.execute(Sql)
OnlineTotal=Rs(0)
Rs.Close

Sql="Select Top 1000 * From CFCount_Online where UserName='"&UserName&"'"
Sql=Sql&" Order By "&PX&" Desc"

Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.open Sql,Conn,1,1
If Not rs.eof then
 If ChkStr(Request("Page"),2) = "" Then
  Page = 1
 Else 
  Page = CInt(ChkStr(Request("Page"),2))
 End If
 
 rs.pagesize=20
 totalrs=rs.RecordCount
 totalpage=rs.pageCount
 mypagesize=rs.pagesize
 rs.absolutepage=page
End If
%>
<table class="tb_2 tb_u">
<tr class="tr_1">
<td colspan="9">在线信息</td>
</tr>
<tr class="tr_2">
 <td class="td_nowrap"><a href="?Action=<%=Action%>&UserName=<%=UserName%>&Px=IP">IP</a></td>
 <td class="td_nowrap"><a href="?Action=<%=Action%>&UserName=<%=UserName%>&Px=PvTotal">PV数量</a></td>
 <td class="td_nowrap"><a href="?Action=<%=Action%>&UserName=<%=UserName%>&Px=ScreenWidth">屏幕分辨率</a></td>
 <td class="td_nowrap"><a href="?Action=<%=Action%>&UserName=<%=UserName%>&Px=ScreenColorDepth">屏幕色彩</a></td>
 <td class="td_nowrap"><a href="?Action=<%=Action%>&UserName=<%=UserName%>&Px=OsType">操作系统</a></td>
 <td class="td_nowrap"><a href="?Action=<%=Action%>&UserName=<%=UserName%>&Px=BrowserType">浏览器</a></td>
 <td class="td_nowrap"><a href="?Action=<%=Action%>&UserName=<%=UserName%>&Px=AddTime">开始访问时间</a></td>
 <td class="td_nowrap"><a href="?Action=<%=Action%>&UserName=<%=UserName%>&Px=LastTime">最后访问时间</a></td>
 <td class="td_nowrap">停留时间</td>
 </tr>

<%
While Not Rs.Eof And MyPageSize>0
%>
<tr class="tr_2">
    <td class="td_nowrap">
        <%If Ip=Rs("Ip") Then Response.Write "<font color=ff0000>"%>
        <%=Rs("Ip")%> 
        <%If Ip=Rs("Ip") Then Response.Write "</font>"%>
        <%
		If Rs("Area")<>"" Then
		 Response.Write "<br>"&Rs("Area")&Rs("Area_2")&Rs("Area_3")
		End If
		 %>
		</td>
    <td class="td_nowrap"><%=Rs("PvTotal")%></td>
    <td class="td_nowrap"><%=Rs("ScreenWidth")%>×<%=Rs("ScreenHeight")%></td>
    <td class="td_nowrap"><%=Rs("ScreenColorDepth")%></td>
    <td class="td_nowrap"><%=Rs("OsType")%></td>
    <td class="td_nowrap"><%=Rs("BrowserType")%></td>
    <td class="td_nowrap"><%=Rs("AddTime")%></td>
    <td class="td_nowrap"><%=Rs("LastTime")%></td>
    <td class="td_nowrap"><%=DateDiff("n",Rs("AddTime"),Rs("LastTime"))%>分钟</td>
  </tr>
<tr>
<td colspan="9" width="970px" style="word-wrap: break-word;word-break:break-all;"><a href="?Action=<%=Action%>&Px=Ly">来源</a>：<a href="?Action=urlgo&Url=<%=Server.URLEncode(Rs("Ly"))%>" target="_blank"><%=server.HTMLEncode(Rs("Ly"))%></a></td>
</tr>
<tr>
<td colspan="9" width="970px" style="word-wrap: break-word;word-break:break-all;"><a href="?Action=<%=Action%>&Px=Currweb">受访页</a>：<a href="?Action=urlgo&Url=<%=Server.URLEncode(Rs("Currweb"))%>" target="_blank"><%=server.HTMLEncode(Rs("Currweb"))%></a></td>
</tr>
  <%rs.movenext
mypagesize=mypagesize-1
wend%>

</table>


<table class="tb_3">
  <tr>
    <td><a href="?Action=<%=Action%>&UserName=<%=UserName%>&Px=<%=Px%>&Page=1">第一页</a>
            <%
if page>1 then%>
            <a href='?Action=<%=Action%>&UserName=<%=UserName%>&Px=<%=Px%>&Page=<%=Page-1%>'>上一页</a>
            <%
end if
%>
            <%
if page<rs.pagecount   then%>
            <a href='?Action=<%=Action%>&UserName=<%=UserName%>&Px=<%=Px%>&Page=<%=Page+1%>'>下一页</a>
            <%

end if
%>
            <a href="?Action=<%=Action%>&UserName=<%=UserName%>&Px=<%=Px%>&Page=<%=totalpage%>">最后一页</a> 页次：<font color="#ff0000"><%=page%></font>/<%=totalpage%>页&nbsp;&nbsp;共<%=totalrs%>条记录&nbsp;&nbsp;每页显示<%=rs.pagesize%>条

<%
Response.write "&nbsp;&nbsp;转到第<select id='page' onChange=""window.location=document.getElementById('page').options[document.getElementById('page').selectedIndex].value"">"
For I=1 To TotalPage
    Response.Write "<option value=?Action="&Action&"&UserName="&UserName&"&Px="&Px&"&Page="&i
 If Page=I Then Response.Write " selected"
 Response.Write ">"& I &"</option>"
Next
Response.write "</select>页"
%>
</td>
  </tr>
</table>
<%End If%>
		
        <%If RsUser("TodayHourOpen")=-1 Then%><br>
 
<table class="tb_2 tb_u">


<%
ShowTotal=0
IpTotal=0
Session("CFCountTemp")=""
Sql="Select Sum(MyCounter),Sum(IpCounter) From CFCount_Count_Hour where UserName='"&UserName&"' And AddDate='"&Date()&"'"
Set Rs=Conn.Execute(Sql)
ShowTotal=Rs(0)
IpTotal=Rs(1)

Sql="Select MyCounter,IpCounter,AddHour From CFCount_Count_Hour where UserName='"&UserName&"' And AddDate='"&Date()&"'"
Set Rs=Conn.Execute(Sql)

If Not Rs.eof Then
  Session("CFCountTemp")=Rs.GetRows(-1)
End If

H=24
If Cstr(Date)=CStr(AddDate_1) Then H=hour(now)
%>
<tr class="tr_1">
          <td colspan="5"><%=Date()%>[<%=GetWeek(Date())%>] 每小时报表</td>
  </tr>
        <tr> 
          <td>&nbsp;</td>
          <td colspan="2">PV访问量</td>
          <td colspan="2">唯一IP</td>
        </tr>
        <tr> 
          <td>&nbsp;</td>
          <td colspan="2">共<%=ShowTotal%>次,平均每小时<%=Int(ShowTotal/H)%>次</td>
          <td colspan="2">共<%=IpTotal%>IP,平均每小时<%=Int(IpTotal/H)%>IP</td>
        </tr>
        <tr> 
          <td>小时</td>
          <td colspan="2">显示数量</td>
          <td colspan="2">IP数量</td>
        </tr>
<%
I=0
For I=0 To 23
ShowNum=0
IpNum=0
J=0
For J=0 To Ubound(Session("CFCountTemp"),2)
 If Session("CFCountTemp")(2,J)=I Then
  ShowNum=Session("CFCountTemp")(0,J)
  IpNum=Session("CFCountTemp")(1,J)
 End If
Next
%>
        <tr> 
          <td><%=I&":00"%>-<%=I+1&":00"%></td>
          <td><%=ShowNum%></td>
          <td><img src=images/bar_blue.gif width=<%=CInt(ShowNum/ShowTotal*200)%> height=10><%=MyRate(ShowNum,ShowTotal)%>%</td>
          <td><%=IpNum%></td>
          <td><img src=images/bar_green.gif width=<%=CInt(IpNum/IpTotal*200)%> height=10><%=MyRate(IpNum,IpTotal)%>%</td>
        </tr>
        <%
Next%>
</table>
        <%End If%>
        <%If RsUser("TodayHourOpen")=-1 Then%>
        <br>
<table class="tb_2 tb_u">

<%
ShowTotal=0
IpTotal=0
Session("CFCountTemp")=""

Sql="Select Sum(MyCounter),Sum(IpCounter) From CFCount_Count_Day where UserName='"&UserName&"' And Datediff(m,AddDate,GetDate())=0"
Set Rs=Conn.Execute(Sql)
ShowTotal=Rs(0)
IpTotal=Rs(1)


Sql="Select MyCounter,IpCounter,AddDate From CFCount_Count_Day where UserName='"&UserName&"' And Datediff(m,AddDate,GetDate())=0"
Set Rs=Conn.Execute(Sql)
If Not Rs.eof Then
  Session("CFCountTemp")=Rs.GetRows(-1)
End If

Date_1=Cdate(Year(Now)&"-"&Month(Now)&"-1")
Date_2=DateAdd("m",1,Date_1)

H=DateDiff("d",Date_1,Date_2)'取得一个月的天数
H_2=H

H_2=Day(now)
%>
<tr class="tr_1">
          <td colspan="5"><%=Year(Now)%>年<%=Month(Now)%>月报表</td>
  </tr>
        <tr> 
          <td>&nbsp;</td>
          <td colspan="2">PV访问量</td>
          <td colspan="2">唯一IP</td>
        </tr>
        <tr> 
          <td>&nbsp;</td>
          <td colspan="2">共&nbsp;<%=ShowTotal%>&nbsp;次,平均每天&nbsp;<%=Int(ShowTotal/H_2)%>&nbsp;次</td>
          <td colspan="2">共&nbsp;<%=IpTotal%>&nbsp;IP,平均每天&nbsp;<%=Int(IpTotal/H_2)%>&nbsp;IP</td>
        </tr>
        <tr> 
          <td>日期</td>
          <td colspan="2">显示数量</td>
          <td colspan="2">IP数量</td>
        </tr>
<%
I=0
For I=1 To H
ShowNum=0
IpNum=0
J=0
For J=0 To Ubound(Session("CFCountTemp"),2)
 If Day(Cdate(Session("CFCountTemp")(2,J)))=I Then
  ShowNum=Session("CFCountTemp")(0,J)
  IpNum=Session("CFCountTemp")(1,J)
 End If
Next
%>
        <tr> 
          <td><%=I%>日</td>
          <td><%=ShowNum%></td>
          <td><img src=images/bar_blue.gif width=<%=CInt(ShowNum/ShowTotal*200)%> height=10><%=MyRate(ShowNum,ShowTotal)%>%</td>
          <td><%=IpNum%></td>
          <td><img src=images/bar_green.gif width=<%=CInt(IpNum/IpTotal*200)%> height=10><%=MyRate(IpNum,IpTotal)%>%</td>
        </tr>
        <%
Next%>
</table>
  
<%End If%>

<%End If%>