<%qx="06"%>
<!--#include file="login/0.asp"-->
<!--#include file="../mycartconn/conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../mycartconn/admin.css" rel="stylesheet" type="text/css">
</head>
<%
   	const MaxPerPage=8
   	dim totalPut   
   	dim CurrentPage
   	dim TotalPages
   	dim title

	title=request("txtitle")
   	if not isempty(request("page")) then
      		currentPage=cint(request("page"))
   	else
      		currentPage=1
   	end if
   	dim sql
   	dim rs
%>
<body>
<table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="100%" align="center" valign="middle"> 
        <table border="0" cellspacing="1" width="550" bordercolorlight="#000000" bordercolordark="#FFFFFF" cellpadding="2">
        <tr bgcolor="#CCCCCC"> 
          <td colspan="3" align="center"> 
<%if title<>"" then
sql="select * from ip where name like '%"&title&"%' or ip like '%"&title&"%'  order by id desc"
else
sql="select * from ip order by id desc"
end if
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1

  	if rs.eof and rs.bof then
       		response.write "<p align='center'> 还没有记录 </p>"
   	else
      		totalPut=rs.recordcount
      		if currentpage<1 then
          		currentpage=1
      		end if
      		if (currentpage-1)*MaxPerPage>totalput then
	   		if (totalPut mod MaxPerPage)=0 then
	     			currentpage= totalPut \ MaxPerPage
	  		else
	      			currentpage= totalPut \ MaxPerPage + 1
	   		end if

      		end if
       		if currentPage=1 then
           		showpage totalput,MaxPerPage,"adminip.asp"
            		showContent
            		showpage totalput,MaxPerPage,"adminip.asp"
       		else
          		if (currentPage-1)*MaxPerPage<totalPut then
            			rs.move  (currentPage-1)*MaxPerPage
            			dim bookmark
            			bookmark=rs.bookmark
           			showpage totalput,MaxPerPage,"adminip.asp"
            			showContent
             			showpage totalput,MaxPerPage,"adminip.asp"
        		else
	        		currentPage=1
           			showpage totalput,MaxPerPage,"adminip.asp"
           			showContent
           			showpage totalput,MaxPerPage,"adminip.asp"
	      		end if
	   	end if
   	rs.close
   	end if
   	set rs=nothing  
   	conn.close
   	set conn=nothing
	
  
sub showContent
dim i
i=0%> 
          </td>
        </tr>
        <%do while not rs.eof%>
        <tr bgcolor="#f1f1f1"> 
          <td width="50" rowspan="2"> 
            <p align="center"><%=rs("id")%> </td>
          <td width="100" align="center"> 
            <p><%=rs("name")%></a> </td>
          <td width="350"><%=rs("win")%></td>
        </tr>
        <tr bgcolor="#f1f1f1"> 
          <td width="100" align="center"><%=rs("ip")%></td>
          <td width="350"><%=rs("sj")%></td>
        </tr>
<%i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop%>
        <tr bgcolor="#CCCCCC" align="center"> 
          <td colspan="3"> 
            <DIV align="center"> 
              <CENTER>
              </CENTER>
            </DIV>
<%end sub 
function showpage(totalnumber,maxperpage,filename)
  dim n
  if totalnumber mod maxperpage=0 then
     n= totalnumber \ maxperpage
  else
     n= totalnumber \ maxperpage+1
  end if
  response.write "<p align='center'>&nbsp;"
  if CurrentPage<2 then
    response.write "首页 上一页&nbsp;"
  else
    response.write "<a href="&filename&"?page=1&txtitle="&title&">首页</a>&nbsp;"
    response.write "<a href="&filename&"?page="&CurrentPage-1&"&txtitle="&title&">上一页</a>&nbsp;"
  end if
  if n-currentpage<1 then
    response.write "下一页 尾页"
  else
    response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&txtitle="&title&">"
    response.write "下一页</a> <a href="&filename&"?page="&n&"&txtitle="&title&">尾页</a>"
  end if
   response.write "&nbsp;页次："&CurrentPage&"/"&n&"页 "
    response.write "&nbsp;共"&totalnumber&"条记录 "&maxperpage&"条记录/页"
end function%> </td>
        </tr>
      </table>
<form name="searchsoft" method="POST" action="adminip.asp">
        查找记录: 
        <input class=wenbenkuang type="text" name="txtitle" size="20">
        <input class=go-wenbenkuang type="submit" value="查 询" name="title">
</form></td>
  </tr>
</table>
</body>
</html>