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

If AddDate="" Then AddDate=Cstr(Date)
If Px="" Then Px="MyCounter"

Call PxFilter(Px,"UserName,MyCounter,IPCounter")
%>
<table class="tb_1">
  
  <tr>
    <td colspan="6"><Select  name="adddate" size="1" onChange="window.location=document.getElementById('adddate').options[document.getElementById('adddate').selectedIndex].value">
<option>请选择日期</option>
<%Sql="Select AddDate From CFCount_Count_Day Group By AddDate Order By AddDate Desc"
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.open Sql,Conn,1,1

While Not Rs.Eof 
 Response.Write "<option value='?Action="&Action&"&AddDate="&Rs("AddDate")&"'"
 If Cstr(AddDate)=Cstr(Rs("AddDate")) Then Response.Write " selected"
 Response.Write ">"&Rs("AddDate")&"&nbsp["&GetWeek(Rs("AddDate"))&"]</option>"  
Rs.MoveNext
Wend  
%>
        </select></td>
  </tr>
  <tr class="tr_1">
    <td colspan="6"><%=AddDate%> 用户排行</td>
  </tr>
<tr class="tr_2">
    <td><a href="?Action=<%=Action%>&AddDate=<%=AddDate%>&Px=UserName">用户名</a></td>
    <td><a href="?Action=<%=Action%>&AddDate=<%=AddDate%>&Px=MyCounter">浏览数量</a></td>
    <td><a href="?Action=<%=Action%>&AddDate=<%=AddDate%>&Px=IpCounter">IP数量</a></td>
  </tr>
<%
Sql="Select * From CFCount_Count_Day Where AddDate='"&AddDate&"'"
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


While Not Rs.Eof And MyPageSize>0
%>
  <tr class="tr_2"> 
    <td><%=Rs("UserName")%></td>
    <td><%=Rs("MyCounter")%></td>
    <td><%=Rs("IpCounter")%></td>
  </tr>
  <%rs.movenext
mypagesize=mypagesize-1
wend%>
</table>
<table class="tb_3">
  <tr>
    <td><a href="?Action=<%=Action%>&AddDate=<%=AddDate%>&Px=<%=Px%>&Page=1">第一页</a>
            <%
if page>1 then%>
            <a href='?Action=<%=Action%>&AddDate=<%=AddDate%>&Px=<%=Px%>&Page=<%=Page-1%>'>上一页</a>
            <%
end if
%>
            <%
if page<rs.pagecount   then%>
            <a href='?Action=<%=Action%>&AddDate=<%=AddDate%>&Px=<%=Px%>&Page=<%=Page+1%>'>下一页</a>
            <%

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

</td>

  </tr>
</table>