<%
'乘风多用户计数器 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="LastTime"
Call PxFilter(Px,"Ip,PvTotal,VisitTotal,Ly,Currweb,AddTime,LastTime,ScreenWidth,ScreenHeight,ScreenColorDepth,OsType,BrowserType")


Set Rs= Server.CreateObject("Adodb.RecordSet")
Sql="Select OnlineTime From CFCount_User Where UserName='"&UserName&"'"
Rs.Open Sql,Conn,1,1
OnlineTime=Rs("OnlineTime")
Rs.Close

Sql="Select Count(ID) From CFCount_Online where UserName='"&UserName&"' And Datediff(n,LastTime,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_1" >
<tr class="tr_1">
<td colspan="9">在线人数统计(<%=OnlineTime%>分钟内共有<%=OnlineTotal%>人在线)</td>
</tr>
<tr class="tr_2">
 <td class="td_nowrap"><a href="?Action=<%=Action%>&Px=IP">IP</a></td>
 <td class="td_nowrap"><a href="?Action=<%=Action%>&Px=PvTotal">PV数量</a></td>
 <td class="td_nowrap"><a href="?Action=<%=Action%>&Px=ScreenWidth">屏幕分辨率</a></td>
 <td class="td_nowrap"><a href="?Action=<%=Action%>&Px=ScreenColorDepth">屏幕色彩</a></td>
 <td class="td_nowrap"><a href="?Action=<%=Action%>&Px=OsType">操作系统</a></td>
 <td class="td_nowrap"><a href="?Action=<%=Action%>&Px=BrowserType">浏览器</a></td>
 <td class="td_nowrap"><a href="?Action=<%=Action%>&Px=AddTime">开始访问时间</a></td>
 <td class="td_nowrap"><a href="?Action=<%=Action%>&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="758px" 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"><%=Rs("Ly")%></a></td>
</tr>
<tr>
<td colspan="9" width="758px" 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"><%=Rs("Currweb")%></a></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>