<!--#include file="conn.asp" -->
<% adm_power_page=1 '分配本页的用户访问权限 %>
<!--#include file="admin_dn.asp" -->
<!--#include file="md5.asp" -->
<% 


  if Trim(Request.QueryString("w"))="del" then
  for i= 1 to request.form("del").count
  sql="delete * from admin where id="&request.form("del")(i)
  conn.execute(sql)
  next
  end if

if Trim(Request.QueryString("w"))="add" then
 if Trim(Request.Form("userid"))="" or Trim(Request.Form("password"))="" then
  msg="新增失败，用户名和密码不能为空..."
  else
  
 sql="select * from admin where userid='"&Request.Form("userid")&"'"
 rs.open sql,conn,1,1
  if  rs.eof then
 
 adm_power1=""
 for i=1 to Request.Form("adm_power").count
 adm_power1=adm_power1&Request.Form("adm_power")(i)
 next
 sql="insert into admin (userid,password,adm_power) values ('"&Request.Form("userid")&"','"&md5(Request.Form("userid"))&"','"&adm_power1&"')"
 conn.execute(sql)
 else
 msg="数据库中已有相同有用户存在"
 end if
 rs.close 
 end if
 
end if

 %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>:::管理页面:::</title>
<link href="css.css" rel="stylesheet" type="text/css">
</head>

<body leftmargin="2" topmargin="0">

<p>　<font color="#990000"><strong>后台用户账号管理</strong></font></p>
<p>&nbsp;</p>
<p>管理员清单</p>

<form name="form1" method="post" action="adm_power.asp?w=del">
  <table width="100%" border="0" cellspacing="1" cellpadding="1">
    <tr bgcolor="#000088"> 
      <td width="11%" height="20" bgcolor="#000088"> <div align="center"><font color="#FFFFFF">id</font></div></td>
      <td width="22%" bgcolor="#000088"> <div align="center"><font color="#FFFFFF">用户名</font></div></td>
      <td width="16%" bgcolor="#000088"> <div align="center"><font color="#FFFFFF">管理权限</font></div></td>
      <td width="21%" bgcolor="#000088"> <div align="center"><font color="#FFFFFF">最后登录时间</font></div></td>
      <td width="14%" bgcolor="#000088"> <div align="center"><font color="#FFFFFF">编 
          辑</font></div></td>
      <td width="16%"> <p align="center"><font color="#FFFFFF">删除账号</font></p></td>
    </tr>
    <%
	rs.open "admin",conn,1,1
	i=0
	 while not rs.eof
	 if rs("userid") <> "wwww" then 
	 i=i+1

	 %>
    <tr bgcolor="#F4F4FF"> 
      <td bgcolor="#F4F4FF"><div align="center"><font color="#FF0000"><%= i %></font></div></td>
      <td bgcolor="#F4F4FF"><div align="center"><%= rs("userid") %></div></td>
      <td bgcolor="#F4F4FF"><div align="center"><%= rs("adm_power") %></div></td>
      <td bgcolor="#F4F4FF"><div align="center"><font color="#FF0000"><%= rs("dat") %></font></div></td>
      <td bgcolor="#F4F4FF"><div align="center"><a href="adm_power_edit.asp?id=<%=rs("id")%>"><img src="images/folder.gif" width="16" height="16" border="0"></a> 
        </div></td>
      <td> <div align="center"> 
          <input name="del" type="checkbox" class="unnamed1" id="del" value="<%=rs("id")%>" >
        </div></td>
    </tr>
    <% 
	end if
	rs.movenext
	wend
	rs.close %>
    <tr bgcolor="#000088"> 
      <td height="18" colspan="5" bgcolor="#000088">&nbsp;</td>
      <td><div align="center">
          <input type="submit" name="Submit" value="-删 除-">
        </div></td>
    </tr>
  </table>
</form>
<p>&nbsp;</p>
<p>增加管理员</p>
<form name="form2" method="post" action="adm_power.asp?w=add">
  <table width="484" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr> 
      <td width="77">&nbsp;</td>
      <td colspan="3">&nbsp;</td>
    </tr>
    <tr> 
      <td height="24">用户名:</td>
      <td width="150">
<input name="userid" type="text" id="userid" size="10"></td>
      <td width="53">密 码:</td>
      <td width="204"> 
        <input name="password" type="text" id="password" size="10"></td>
    </tr>
    <tr> 
      <td height="26">管理员权限:</td>
      <td colspan="3"><table width="407" border="0" cellspacing="2" cellpadding="0">
          <tr> 
            <td width="21"> 
              <input name="adm_power" type="checkbox" class="unnamed1" id="adm_power" value="1"> 
            </td>
            <td width="77">基本资料</td>
            <td width="20">
<input name="adm_power" type="checkbox" class="unnamed1" id="adm_power" value="2"></td>
            <td width="81">公告管理<font color="#FFFFFF"><strong><br>
              </strong></font></td>
            <td width="20">
<input name="adm_power" type="checkbox" class="unnamed1" id="adm_power" value="3"></td>
            <td width="174">产品管理</td>
          </tr>
          <tr>
            <td><input name="adm_power" type="checkbox" class="unnamed1" id="adm_power" value="4"></td>
            <td>订单管理</td>
            <td><input name="adm_power" type="checkbox" class="unnamed1" id="adm_power" value="5"></td>
            <td>财务管理</td>
            <td><input name="adm_power" type="checkbox" class="unnamed1" id="adm_power" value="6"></td>
            <td>用户管理</td>
          </tr>
          <tr>
            <td><input name="adm_power" type="checkbox" class="unnamed1" id="adm_power" value="7"></td>
            <td>&nbsp;</td>
            <td><input name="adm_power" type="checkbox" class="unnamed1" id="adm_power" value="8"></td>
            <td>&nbsp;</td>
            <td><input name="adm_power" type="checkbox" class="unnamed1" id="adm_power" value="9"></td>
            <td>&nbsp;</td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td colspan="3"><input type="submit" name="Submit2" value="-确定新增-"></td>
    </tr>
  </table>
</form>
<p align="center"><font color="#FF0000"><%= msg %></font></p>
<hr width="95%" size="1">
<p><font color="#FF0000">　注:</font>这里对管理员权限是用数字表示表示为: 1 基本资料 2 公告管理<font color="#FFFFFF"><strong></strong></font> 
  3 产品管理 4 订单管理 5 财务管理 6 用户管理</p>
<p> 　　　</p>
<p>&nbsp;</p>
</body>
</html>
