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

<table class="tb_1">
<TR class="tr_2">
<TD>
<%
Session("CFCountTemp")=""
Sql="Select IsNull(Sum(MyCounter),0) As MyCounter,IsNull(Sum(IPCounter),0) As IPCounter,AddDate From CFCount_Count_Day where Datediff(d,AddDate,getdate())<30 Group By AddDate Order By AddDate "

Set Rs=Conn.Execute(Sql)

While Not Rs.eof
TitleStr=TitleStr&"<category label='"&Rs("AddDate")&"' />"
PvStr=PvStr & "<set value='"&Rs("MyCounter")&"' />"
IpStr=IpStr & "<set value='"&Rs("IPCounter")&"' />"
Rs.MoveNext
Wend


%>
<OBJECT classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width=750 height=450>
<PARAM NAME="FlashVars" VALUE="dataXML=<graph caption='系统总流量统计' subcaption='最近30天' showFCMenuItem='0' lineThickness='1' showValues='0' formatNumberScale='0' anchorRadius='3'   divLineAlpha='20' divLineColor='CC3300' divLineIsDashed='1' showAlternateHGridColor='1' alternateHGridAlpha='10' alternateHGridColor='#CCCC00' shadowAlpha='40' numvdivlines='5'  bgColor='cccccc,cccccc' bgAngle='270' bgAlpha='10,10' baseFontSize='12' bordercolor='ffffff'  rotateNames='1' slantLabels='1'><categories ><%=TitleStr%></categories><dataset seriesName='IP' color='1D8BD1' anchorBorderColor='1D8BD1' anchorBgColor='1D8BD1'><%=IpStr%></dataset><dataset seriesName='PV' color='F1683C' anchorBorderColor='F1683C' anchorBgColor='F1683C'><%=PvStr%></dataset></graph>">
<PARAM NAME="movie" VALUE="images/MSLine.swf">
<embed src="images/MSLine.swf" width="750" height="450" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" FlashVars="dataXML=<graph caption='系统总流量统计' subcaption='最近30天' showFCMenuItem='0' lineThickness='1' showValues='0' formatNumberScale='0' anchorRadius='3'   divLineAlpha='20' divLineColor='CC3300' divLineIsDashed='1' showAlternateHGridColor='1' alternateHGridAlpha='10' alternateHGridColor='#CCCC00' shadowAlpha='40' numvdivlines='5'  bgColor='cccccc,cccccc' bgAngle='270' bgAlpha='10,10' baseFontSize='12' bordercolor='ffffff'  rotateNames='1' slantLabels='1'><categories ><%=TitleStr%></categories><dataset seriesName='IP' color='1D8BD1' anchorBorderColor='1D8BD1' anchorBgColor='1D8BD1'><%=IpStr%></dataset><dataset seriesName='PV' color='F1683C' anchorBorderColor='F1683C' anchorBgColor='F1683C'><%=PvStr%></dataset></graph>"></embed>
</OBJECT>
</TD></TR>
<table>	


<table class="tb_1">
  <%
Action=Action


Sql="Select IsNull(Sum(MyCounter),0),IsNull(Sum(IPCounter),0) From CFCount_Count_Day"
Set Rs1=Conn.execute(Sql)
ShowTotal=Rs1(0)
IpTotal=Rs1(1)

Sql="Select AddDate,IsNull(Sum(MyCounter),0) As MyCounter,IsNull(Sum(IPCounter),0) As IPCounter From CFCount_Count_Day Group By AddDate Order By AddDate 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

%>
<tr class="tr_1">
    <td colspan="6">系统总流量每天统计</td>
  </tr>
<tr class="tr_2">
    <td>序号</td>
    <td>日期</td>
    <td colspan="2">浏览数量</td>
    <td colspan="2">IP数量</td>
  </tr>
<%
While Not Rs.Eof And MyPageSize>0
%>
  <tr class="tr_2"> 
    <td><%=Rs.RecordCount-Rs.Pagesize*(page)+mypagesize%></td>
    <td><%=Rs("AddDate")%></td>
    <td><%=Rs("MyCounter")%></td>
    <td class="td_1"><img src=images/bar_blue.gif width=<%=CInt(Rs("MyCounter")/ShowTotal*200)%> height=10><%=MyRate(Rs("MyCounter"),ShowTotal)%>%</td>
    <td><%=Rs("IpCounter")%></td>
    <td class="td_1"><img src=images/bar_green.gif width=<%=CInt(Rs("IpCounter")/IpTotal*200)%> height=10><%=MyRate(Rs("IpCounter"),IpTotal)%>%</td>
  </tr>
  <%rs.movenext
mypagesize=mypagesize-1
wend%>
<tr>
    <td colspan="6" >
<%
If TotalRs=0 Then
 AvgVisit=0
 AvgIp=0
Else
 AvgVisit=Int(ShowTotal/TotalRs)
 AvgIp=Int(IpTotal/TotalRs)
End If
%>
      共有<%=TotalRs%>天记录，共<%=Rs1(0)%>次浏览，<%=Rs1(1)%>个IP，平均每天<%=AvgVisit%>次访问，平均每天IP<%=AvgIp%>个 </td>
  </tr>
</table>
<table class="tb_3">
  <tr>
    <td><a href="?Action=<%=Action%>&Page=1">第一页</a>
            <%
if page>1 then%>
            <a href='?Action=<%=Action%>&Page=<%=Page-1%>'>上一页</a>
            <%
end if
%>
            <%
if page<rs.pagecount   then%>
            <a href='?Action=<%=Action%>&Page=<%=Page+1%>'>下一页</a>
            <%

end if
%>
            <a href="?Action=<%=Action%>&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&"&Page="&i
 If Page=I Then Response.Write " selected"
 Response.Write ">"& I &"</option>"
Next
Response.write "</select>页"
%>

</td>

  </tr>
</table>