<%@language=vbscript codepage=936 %>
<!--#include file="Conn.asp"-->
<!--#include file="admin.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
dim strFileName
const MaxPerPage=20
dim totalPut,CurrentPage,TotalPages
dim rs, sql
strFileName="UserManage.asp"

if request("page")<>"" then
    currentPage=cint(request("page"))
else
	currentPage=1
end if

Set rs=Server.CreateObject("Adodb.RecordSet")
sql="select * from [User] order by UserID desc"
rs.Open sql,conn,1,1
%>
<script language=javascript>
function ConfirmDel()
{
   if(confirm("确定要删除此用户吗？"))
     return true;
   else
     return false;
}
function openwin(href)
{
	window.open(href,'answerwin','location=no,height=430, width=600, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no');
}
</script>
<!-- #include file="Inc/Head.asp" -->
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="150" align="center" valign="top" bgcolor="#A0CCD8">
	<!-- #include file="user_left.asp" -->
	</td>
    <td width="862" align="center" valign="top">
	<table width="100%" height="0"  border="0" cellpadding="5" cellspacing="0">
      <tr>
        <td height="24" background="image/usercenter_3.jpg">
          <div align="center"><strong><font color="#FFFFFF">会 员 管 理</font></strong></div></td>
      </tr>
    </table>
<%
  	if rs.eof and rs.bof then
		response.write "目前共有 0 个注册用户"
	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 strFileName,totalput,MaxPerPage,true,true,"个用户"
        	showContent
        	showpage strFileName,totalput,MaxPerPage,true,true,"个用户"
   	 	else
   	     	if (currentPage-1)*MaxPerPage<totalPut then
         	   	rs.move  (currentPage-1)*MaxPerPage
         		dim bookmark
           		bookmark=rs.bookmark
        		showpage strFileName,totalput,MaxPerPage,true,true,"个用户"
            	showContent
            	showpage strFileName,totalput,MaxPerPage,true,true,"个用户"
        	else
	        	currentPage=1
        		showpage strFileName,totalput,MaxPerPage,true,true,"个用户"
           		showContent
           		showpage strFileName,totalput,MaxPerPage,true,true,"个用户"
	    	end if
		end if
	end if

sub showContent
   	dim i
    i=0
%>
      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
        <tr bgcolor="#C2DAE1" class="title"> 
          <td height="25" align="center"><div align="center"><strong> ID </strong></div></td>
          <td height="25" align="center"><strong> 用户名</strong></td>
          <td height="25" align="center"><strong> 性别</strong></td>
          <td height="25" align="center"><strong>Email</strong></td>
          <td height="25" align="center"><strong>真实姓名</strong></td>
          <td height="25" align="center"><strong> 状态</strong></td>
          <td height="25" align="center"><strong> 
            操作</strong></td>
        </tr>
        <%do while not rs.EOF %>
        <tr bgcolor="#EFEEE9" class="tdbg"> 
          <td height="22" align="center"><%=rs("UserID")%></td>
          <td align="center"><a href="javascript:openwin('kanuser.asp?UserID=<%=rs("UserID")%>');"><%=rs("username")%></a></td>
          <td align="center"> 
          <%if rs("Sex")=1 then
	    response.write "男"
	  else
	    response.write "女"
	  end if%>          </td>
          <td><div align="center"><%=rs("email")%></div></td>
          <td> <div align="center"><%=rs("name")%> </div></td>
          <td align="center"> 
          <%
	  if rs("LockUser")=true then
	  	response.write "已锁定"
	  else
	  	response.write "正常"
	  end if
	  %>          </td>
          <td align="center">
		    <%call man_r("UserModify.asp?UserID="&rs("UserID")&"","修改","User_Man")%>&nbsp; 
		  
            <%if rs("LockUser")=False then 
				  call man_r("UserLock.asp?Action=Lock&UserID="&rs("UserID")&"","锁定","User_Man")
		      else
			      call man_r("UserLock.asp?Action=CancelLock&UserID="&rs("UserID")&"","<font color=red>解锁</font>","User_Man")
			  end if		  
		    %>&nbsp;
			<%call man_rdel("UserDel.asp?UserID="&rs("UserID")&"","删除","User_Man")%>
          </td>
        </tr>
        <%
	i=i+1
	if i>=MaxPerPage then exit do
	rs.movenext
loop
%>
      </table>  
<%
end sub 
%>    </td>
  </tr>
</table>
<!-- #include file="Inc/Foot.asp" -->
<%
rs.Close
set rs=Nothing
  
%>