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

<%
Px=ChkStr(Request("Px"),1)

If Px="" Then  Px="IpCounter"


Call PxFilter(Px,"id,area,IpCounter,lasttime")

%>
<table class="tb_1">

  <%
Sql="Select Sum(IpCounter) From CFCount_Area where UserName='"&UserName&"'"
Set Rs=Conn.execute(Sql)
IpTotal=Rs(0)

Sql="Select * From CFCount_Area 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
%>
<tr>
    <td colspan="5">全部时间地区统计[可点击标题排序]</td>
  </tr>
  <tr class="tr_1"> 
    <td><a href="?Action=<%=Action%>&Px=ID">序号</a></td>
    <td><a href="?Action=<%=Action%>&Px=Area">地区</a></td>
    <td colspan="2"><a href="?Action=<%=Action%>&Px=IPCounter">IP数量</a></td>
    <td><a href="?Action=<%=Action%>&Px=LastTime">最后访问时间</a></td>
  </tr>
  <%
While Not Rs.Eof And MyPageSize>0
%>
  <tr class="tr_2"> 
    <td><%=Rs.RecordCount-Rs.Pagesize*(page)+mypagesize%></td>
    <td> 
        <%
		If Rs("Area")="" Then
		 Response.write "未知地区"
		Else
		 Response.write Rs("Area")
		End If%>
      </td>
    <td><%=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><%=Rs("LastTime")%></td>
  </tr>
  <%rs.movenext
mypagesize=mypagesize-1
wend%>
</table>
<table class="tb_3">
  <tr>
    <td><a href="?Action=<%=Action%>&Px=<%=Px%>&Page=1">第一页</a>
            <%
if page>1 then%>
            <a href='?Action=<%=Action%>&Px=<%=Px%>&Page=<%=Page-1%>'>上一页</a>
            <%
end if
%>
            <%
if page<rs.pagecount   then%>
            <a href='?Action=<%=Action%>&Px=<%=Px%>&Page=<%=Page+1%>'>下一页</a>
            <%

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