<!-- #include file="../admin/check_master.asp" -->
<!--#include file="../inc/conn.asp"-->
<link rel="stylesheet" href="../css/xmwuye.css">
<%
  seachstr=request("seachstr")

   const MaxPerPage=20
   dim totalPut   
   dim CurrentPage
   dim TotalPages
   dim i,j
   
   if not isempty(request("page")) then
      currentPage=cint(request("page"))
   else
      currentPage=1
   end if
   dim sql
   dim rs
   %>

<body leftmargin="0" topmargin="5">
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <form name="form1" method="post" action="">
      <tr bgcolor="#d6dff7"> 
        <td height="30" align="right" bgcolor="#d6dff7"><div align="center">搜索用户： 
            <input name="seachstr" type="text" id="seachstr" size="20">
            <select name="kind">
              <option value="clubuser_id" selected>用户ID号</option>
              <option value="clubuser_name" >用户名</option>
              <option value="clubuser_nickname">昵称</option>
              <option value="clubuser_phone">电话</option>
              <option value="clubuser_ip">IP地址</option>
              <option value="clubuser_email">E-mail</option>
              <option value="clubuser_note">备注</option>
            </select>
            <input type="submit" name="Submit" value=" 搜 索 ">
          </div></td>
      </tr>
    </form>
  </table>

  
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
      <td width="100%"> 
        <div align="center">
 <%
login_sort=request("login_sort")
if login_sort="" then
	str_sort=""
else
	str_sort="clubuser_enter_count "&login_sort&","
end if
if request("seachstr")<>"" then
   sql="select clubuser_id,clubuser_name,clubuser_nickname,clubuser_password,clubuser_phone,clubuser_fax,clubuser_url,clubuser_email,clubuser_enter_count,clubuser_reg_date,clubuser_lasttime,clubuser_ip,payuser,bbsmanager,bbsadmin from clubuser where "&request("kind")&" like '%"&seachstr&"%' order by "&str_sort&" clubuser_id desc"
else
   sql="select clubuser_id,clubuser_name,clubuser_nickname,clubuser_password,clubuser_phone,clubuser_fax,clubuser_url,clubuser_email,clubuser_enter_count,clubuser_reg_date,clubuser_lasttime,clubuser_ip,payuser,bbsmanager,bbsadmin from clubuser order by "&str_sort&" clubuser_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><p align='center'><a href='user_edit.asp'><font color='red'>增加用户</font></a></p>"
   else
	  totalPut=rs.recordcount
      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,"user_manage.asp"
            showContent
            showpage totalput,MaxPerPage,"user_manage.asp"
       else
          if (currentPage-1)*MaxPerPage<totalPut then
            rs.move  (currentPage-1)*MaxPerPage
            dim bookmark
            bookmark=rs.bookmark
           'showpage totalput,MaxPerPage,"user_manage.asp"
            showContent
             showpage totalput,MaxPerPage,"user_manage.asp"
        else
	        currentPage=1
           'showpage totalput,MaxPerPage,"user_manage.asp"
           showContent
           showpage totalput,MaxPerPage,"user_manage.asp"
	      end if
	   end if
   rs.close
   end if
	        
   set rs=nothing  
   sub showContent
       dim i
	   i=0

%>
          <TABLE width=100% border=0 align=center>
            <TR align=right>
<FORM METHOD=POST ACTION="user_manage.asp">
	            <TD bgcolor="#FFFFFF"> 登录次数排序： 
                  <SELECT NAME="login_sort">
	<option value="desc">降序
	<option value="asc">升序
	</SELECT>
	<INPUT TYPE="submit" value="确定">
	</TD>
</FORM>

</TR>
</TABLE>  
              
        <table width="100%" border="0" cellpadding="0" cellspacing="1" bordercolorlight="#000000" bordercolordark="#FFFFFF" bgcolor="#666666">
          <tr bgcolor="#d6dff7" height=22> 
            <td width="5%" align="center" height="20"><strong>ID号</strong></td>
            <td width="8%" align="center"><strong>姓名</strong></td>
            <td width="8%" align="center"><strong>称呼</strong></td>
            <td width="10%" align="center"><strong>管理员</strong></td>
            <td width="8%" align="center"><strong>电话</strong></td>
            <td  align="center"><strong>电子信箱</strong></td>
            <td width="8%" align="center"><strong>次数</strong></td>
            <td width="4%" align="center"><strong>IP</strong></td>
            <td width="15%" align="center"><strong>登记时间</strong></td>
            <td width="13%" align="center"><strong>最后登录</strong></td>
            <td width="5%" align="center" bgcolor="#d6dff7"><strong>版主</strong></td>
            <td width="2%" align="center" bgcolor="#d6dff7"><strong>封锁</strong></td>
            <td width="3%" align="center" bgcolor="#d6dff7"><strong>上传权限</strong></td>
            <td width="5%" align="center"><strong>修改</strong></td>
            <td width="5%" align="center"><strong>删除</strong></td>
          </tr>
          <%do while not rs.eof%>
          <tr bgcolor="#FFFFFF"> 
            <td  height=22> <p align="center"><FONT COLOR="blue"><%=rs("clubuser_id")%></FONT></td>
            <td > <p align="center"><%=rs("clubuser_name")%></p></td>
            <td > <p align="center"><%=rs("clubuser_nickname")%></p></td>
            <td > <p align="center"> 
                <%if rs("bbsadmin")=1 then%>
                <a href="user_delete.asp?id=<%=rs("clubuser_id")%>&m=3&bbsmanager=0"><font color=red>是</font></a> 
                <%else%>
                <a href="user_delete.asp?id=<%=rs("clubuser_id")%>&m=3&bbsmanager=1">否</a> 
                <%end if%>
              </p></td>
            <td > <p align="center"><%=rs("clubuser_phone")%></p></td>
            <td > <p align="center"><%=rs("clubuser_email")%></p></td>
            <td > <p align="center"><%=rs("clubuser_enter_count")%></p></td>
            <td > <%=rs("clubuser_ip")%>&nbsp; </td >
            <td > <p align="center"><%=year(rs("clubuser_reg_date"))%>/<%=month(rs("clubuser_reg_date"))%>/<%=day(rs("clubuser_reg_date"))%></p></td>
            <td > <p align="center"><%=day(rs("clubuser_lasttime"))%></p></td>
            <td ><div align="center"> 
                <%if rs("bbsmanager")=1 then%>
                <a href="user_delete.asp?id=<%=rs("clubuser_id")%>&m=1&bbsmanager=0"><font color=red>是</font></a> 
                <%else%>
                <a href="user_delete.asp?id=<%=rs("clubuser_id")%>&m=1&bbsmanager=1">否</a> 
                <%end if%>
              </div></td>
            <td ><div align="center"> 
                <%if rs("payuser")=3 then%>
                <a href="payusersign.asp?id=<%=rs("clubuser_id")%>&a=3&payuser=0"><font color=red>是</font></a> 
                <%else%>
                <a href="payusersign.asp?id=<%=rs("clubuser_id")%>&a=3&payuser=3">否</a> 
                <%end if%>
              </div></td>
            <td ><div align="center">
                <%if rs("payuser")=2 then%>
                <a href="payusersign.asp?id=<%=rs("clubuser_id")%>&a=2&payuser=0"><font color=red>关</font></a> 
                <%else%>
                <a href="payusersign.asp?id=<%=rs("clubuser_id")%>&a=2&payuser=2">开</a> 
                <%end if%>
              </div></td>
            <td > <p align="center"><a href="user_edit.asp?id=<%=rs("clubuser_id")%>">修改</a></p></td>
            <td > <p align="center"><a href="user_delete.asp?id=<%=rs("clubuser_id")%>&m=2">删除</a></p></td>
          </tr>
          <% i=i+1
	      if i>=MaxPerPage then exit do
	      rs.movenext
	      loop
		 %>
        </table>
      </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 "<form method=Post action="&filename&">"
  response.write "<p align='center'>"
  if CurrentPage<2 then
    response.write "<font color='#000080'>首页 上一页</font>&nbsp;"
  else
    response.write "<a href="&filename&"?page=1&login_sort="&login_sort&">首页</a>&nbsp;"
    response.write "<a href="&filename&"?page="&CurrentPage-1&"&login_sort="&login_sort&">上一页</a>&nbsp;"
  end if
  if n-currentpage<1 then
    response.write "<font color='#000080'>下一页 尾页</font>"
  else
    response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&login_sort="&login_sort&">"
    response.write "下一页</a> <a href="&filename&"?page="&n&"&login_sort="&login_sort&">尾页</a>"
  end if
   response.write "<font color='#000080'>&nbsp;页次：</font><strong><font color=red>"&CurrentPage&"</font><font color='#000080'>/"&n&"</strong>页</font> "
    response.write "<font color='#000080'>&nbsp;共<b>"&totalnumber&"</b>个记录 <b>"&maxperpage&"</b>个记录/页</font> "
   response.write " <font color='#000080'>转到：</font><input type='text' name='page' size=4 maxlength=10 class=smallInput value="&currentpage&">"
   response.write "<INPUT TYPE='hidden' name='login_sort' value='"&login_sort&"'> "
   response.write "<input class=buttonface type='submit'  value='Goto'  name='cndok'></span></p></form>"
       
end function
session("currentpage")=currentpage
 
%>
          <br>
        </div>
</td>
  </tr>
</table>
</center>
