<!--#include file="../inc/Conn.asp"-->
<!--#include file="Inc/Admin.Asp"-->
<!-- #include file="Inc/Head.asp" -->
<%
PurviewValue="sysadmin_count"
If not CheckAdmin(PurviewValue) then
Response.Write("<script language=""JavaScript"">alert(""越权操作!"");history.go(-1);")
response.end
End If
%>
<%

method=Request.QueryString("method")
pageno=Request.QueryString("pageno")

htmltitle="网站访问情况"
htmlname="sysadmin_count.asp?flag=1"
set rs=server.CreateObject("ADODB.Recordset")

if method="clearall" then
	sqltext="delete from webcount"
	conn.Execute sqltext
end if 
sqltext="select querycount from count where code='1'"
rs.Open sqltext,conn,1,1
totcount=rs(0)
rs.Close
%>
<form name="form1"><table width="100%" align=center>
	<tr>
	<table width="90%" height="97" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
      <tr>
        <td class="topbg" height="25" align="center"><strong><%=htmltitle%></b>(共有<span style="color: #00FFFF"><%=totcount%></span>人次访问)</strong></td>
      </tr>
      <tr class="a4">
        <td align="center"><table width="100%" height="20" border="0" cellpadding="2" cellspacing="1">
            <tr>
              <%
		sqltext="select * from webcount order by keyno desc"
		'Response.Write sqltext
		rs.Open sqltext,conn,1,1

	    colzs=2
		rowzs=30	
  		rs.PageSize=colzs*rowzs
		if pageno="" then 
			pageno=1
		else
			pageno=cint(pageno)	
		end if	
		if rs.PageCount>0 then rs.AbsolutePage=pageno
	%>
              <td width=200 align="left" bgcolor="#F0F0F0" class=tdbg><a href="Javascript:window.location.reload()">[刷新列表]</a>
                  <!-- <a href="sysadmin_count_report.asp">[日访问量]</a> -->
                <a href="Javascript:delrec()">[清空记录]</a> </td>
              <td  align="right" bgcolor="#F0F0F0" class="tdbg"><%if rs.PageCount>1 then%>
                [第<b><%=pageno%></b>页, 共<b><%=rs.PageCount%></b>页<b><%=rs.RecordCount%></b>条记录]
                <%if pageno>1 then%>
                <a class=r href="<%=htmlname%>&pageno=1">首页</a> <a class=r href="<%=htmlname%>&pageno=<%=pageno-1%>">上页</a>
                <%end if              
			if pageno<rs.PageCount then%>
                <a class=r href="<%=htmlname%>&pageno=<%=pageno+1%>">下页</a> <a class=r href="<%=htmlname%>&pageno=<%=rs.PageCount%>">末页</a>
                <%end if%>
                <%end if              
		%>
              </td>
            </tr>
          </table>
          <table width="100%" border="0" cellspacing="1" cellpadding="1" >
            <tr bgcolor="336699"  align="center">
              <td height="22"  class="Title">编号</td>
              <td  class="Title" >登录时间</td>
              <td  class="Title" >IP地址</td>
              <td  class="Title">编号</td>
              <td  class="Title" >登录时间</td>
              <td  class="Title" >IP地址</td>
            </tr>
            <%
		i=1
	    do while i<=rowzs and not rs.EOF
			if (i mod 2)=0 then
				Response.Write("<tr bgcolor=fefefe>")
			else
				Response.Write("<tr bgcolor=efefef>")
			end if	
		    for j=1 to colzs
				if not rs.EOF then
			%>
  <td width=30 align=right bgcolor="#F0F0F0" class="tdbg"><%=((pageno-1)*colzs*rowzs+(i-1)*colzs+j)%></td>
      <td width="150" align=right bgcolor="#F0F0F0" class="tdbg"><%=rs("logindate")%> </td>
    <td width="120" align=right bgcolor="#F0F0F0" class="tdbg"><%=trim(rs("ipaddress"))%></td>
    <%
					rs.MoveNext
				else
				%>
      <td width=30 bgcolor="#F0F0F0" class="tdbg">　</td>
    <td width="120" align=left bgcolor="#F0F0F0" class="tdbg"></td>
    <td width="120" align=right bgcolor="#F0F0F0" class="tdbg"></td>
    <%
				end if
			next	
			%>
      </tr><tr>
    <td colspan="6" align=right bgcolor="#F0F0F0" class="tdbg">[第<b><%=pageno%></b>页, 共<b><%=rs.PageCount%></b>页<b><%=rs.RecordCount%></b>条记录]
      <%if pageno>1 then%>
      <a class=r1 href="<%=htmlname%>&pageno=1">[首页]</a> <a class=r1 href="<%=htmlname%>&pageno=<%=pageno-1%>">[上页]</a>
      <%end if              
			if pageno<rs.PageCount then%>
      <a class=r1 href="<%=htmlname%>&pageno=<%=pageno+1%>">[下页]</a> <a class=r1 href="<%=htmlname%>&pageno=<%=rs.PageCount%>">[末页]</a>
      <%end if%></td>
    </tr>
  <%	
			i=i+1
		loop
		%>
          </table></td>
      </tr>
    </table></form>

<!-- #include file="Inc/Foot.asp" -->
<%
%>

<script language="Javascript">
	function delrec()
	{
		if (confirm('您确认要清空网站访问记录吗？')==true)
		{
		window.location.href="<%=htmlname%>&method=clearall"
		return false;
		}
	}

</script>

