<!-- #INCLUDE FILE = "conn.asp" -->
<!-- #INCLUDE FILE = "date.asp" -->
<!-- #INCLUDE FILE = "session.asp" -->
<%
dim Rs,sql,pagenum,totalnum,pagesizes,currentpage,nextpage,prepage
pagesizes=20
if(request.QueryString("page")<>"") then
	currentpage=Cint(request.QueryString("page"))
else
	currentpage=1
end if
totalnum=conn.execute("select count(*) from t_onlineuser")(0)
pagenum=Cint((totalnum+pagesizes-1)/pagesizes)
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Untitled Document</title>
<link href="style/css.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
.style2 {
	color: #cc3300;
	font-weight: bold;
}
.style3 {
	color: #006699;
	font-weight: bold;
}
.style4 {
	color: #000000;
	font-weight: bold;
}
-->
</style>
<script language="javascript">
function goto(frm)
{
	var gourl ="?";
	gourl += "page=" + (frm.page.value);
     var hid=parseInt(frm.hid.value);
	 if(parseInt(frm.page.value)>hid||frm.page.value<=0){
	 alert("错误！请确定你输入的数字在1-"+hid+"之间");
	 return false;
	 }
	window.location.href(gourl);
}</script>
</head>
<%
if(databaseType=1) then
	conn.execute("delete from t_onlineuser where dateDiff('d',f_timevisite,'"&strDate&"')>0")
else
	conn.execute("delete from t_onlineuser where dateDiff(d,f_timevisite,'"&strDate&"')>0")
end if
conn.execute("delete from t_onlineuser where f_timevisite is null")
%>
<body>
<p><br />
  &nbsp;&nbsp;<span class="style3">在线用户：</span><span class="style2"><%=conn.execute("select count(*) from t_onlineuser")(0)%></span></p>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000">
  <tr>
    <td height="20" bgcolor="#006699"><div align="center" class="style1">在线用户统计</div></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
      <tr>
        <td width="34%" height="20" valign="bottom" bgcolor="#F5F5F5">      <div align="center">来路</div>
        <td width="36%" valign="bottom" bgcolor="#F5F5F5">      <div align="center">页面</div>
        <td width="14%" valign="bottom" bgcolor="#F5F5F5"><div align="center">日间</div></td>
        <td width="16%" valign="bottom" bgcolor="#F5F5F5"><div align="center">IP</div></td>
      </tr>
      
	  <%	  	
		Set Rs=Server.CreateObject("ADODB.Recordset")
		if(currentpage=1) then
			sql="select top "&pagesizes&" f_pageurl,f_from,f_timevisite,f_ip from t_onlineuser order by id desc"
		else
			sql="select top "&pagesizes&" f_pageurl,f_from,f_timevisite,f_ip from t_onlineuser WHERE id not in (select top "&(pagesizes*(currentpage-1))&" id from t_onlineuser order by id desc) order by id desc"
		end if		
		Rs.open sql,conn,3,1
		while not rs.eof			
	  %>
	  <tr>
        <td height="20" valign="bottom" bgcolor="#FFFFFF"><div align="left"><a href="<%=rs(1)%>" target="_blank"><%=rs(1)%></a></div>
        <td valign="bottom" bgcolor="#FFFFFF"><div align="left"><a href="<%=rs(0)%>" target="_blank"><%=rs(0)%></a></div>
        <td valign="bottom" bgcolor="#FFFFFF"><div align="center"><%=rs(2)%></div></td>
	    <td valign="bottom" bgcolor="#FFFFFF"><div align="center"><%=rs(3)%></div></td>
	  </tr>
	   <%
	 	 Rs.movenext
	  wend
	  Rs.close
	  set Rs=nothing
	  %>
     
    </table></td>
  </tr>
</table>
<div align="center"><form name="form1" method="post" action="" style="margin:0 0 0 0">
<%
nextpage=currentpage+1
prepage=currentpage-1
if prepage>0then
	response.write("["&"<a href='?page="&cstr(prepage)&"'>上一页</a>]&nbsp;&nbsp;&nbsp;")
else
	response.write("上一页&nbsp;&nbsp;&nbsp;")
end if 
if (nextpage-1)*pagesizes>=totalnum then 
	response.write("下一页" )
else
	response.Write("["&"<a href='?page="&cstr(nextpage)&"'>下一页</a>]")
end if
response.write("&nbsp;共"&totalnum&"条&nbsp;")
response.Write("&nbsp;共"&pagenum&"页&nbsp;")
response.Write("&nbsp;第"&currentpage&"页&nbsp;")
%>
          <input type="hidden" name="hid" value="<%=pagenum%>">
&nbsp;&nbsp;跳至
          <input name="page" type="text" size="5" onChange="goto(this.form)" style="border:1px solid #000000;height:18px ">
          页
          <input type="button" name="Button22" value="Go->" style="font-size:12px ;border:1px solid #000000;height:18px ">
        </form></div>
</body>
</html>
<%
call connclose()
%>