<!--#include file=conn.asp-->
<%if session(hxCacheName&"_admin")<>"OK" then
    response.redirect("admin_login.asp")
    end if
 if request.cookies(hxCacheName&"_rank")("rank")>1 then
  	response.write "<script language='javascript'>"
	response.write "alert('您的级别不够！');"
	response.write "location.href='javascript:history.go(-1)';"			
	response.write "</script>"
    end if%>
<link href="../style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
body {
	background-color: #dadae9;
}
-->
</style>
<div align="center">
  <form method="POST" action="admin_addchk.asp">
  <center>
  <table style="BORDER-COLLAPSE: collapse" borderColor="#ADAED6" height="68" cellSpacing="0" cellPadding="0" width="100%" border="1">
    <tr>
      <td bgColor="#BDBEDE" height="28">
      <p align="left" class="style1"><font size="3"><font size="2">&nbsp;</font></font>增加管理员</td>
    </tr>
    <tr>
      <td height="25" align="middle" bgcolor="#FFFFFF" style="BORDER-BOTTOM: medium none"><div align="left"><br>
          <span class="style1"><font size="3"><font size="2">&nbsp;</font></font></span><span class="style1"><font size="3"><font size="2">&nbsp;<font size="3"><font size="2">&nbsp;</font></font></font></font></span>用 户 名：
            <input name="adminname" size="15" maxlength="15">
      </div></td>
    </tr>
    <tr>
      <td height="25" align="middle" bgcolor="#FFFFFF" style="BORDER-TOP: medium none; BORDER-BOTTOM: medium none"><div align="left"><span class="style1"><font size="3"><font size="2">&nbsp;</font></font></span><span class="style1"><font size="3"><font size="2">&nbsp;</font></font></span><span class="style1"><font size="3"><font size="2">&nbsp;</font></font></span>密&nbsp; &nbsp;&nbsp;码：
            <input type="password" name="password" size="15" maxlength="15">
      </div></td>
    </tr>
    <tr>
      <td height="25" align="middle" bgcolor="#FFFFFF" style="BORDER-TOP: medium none; BORDER-BOTTOM: medium none"><div align="left"><span class="style1"><font size="3"><font size="2">&nbsp;</font></font></span><span class="style1"><font size="3"><font size="2">&nbsp;</font></font></span><span class="style1"><font size="3"><font size="2">&nbsp;</font></font></span>密码确认：
            <input type="password" name="password2" size="15" maxlength="15">
      </div></td>
    </tr>
    <tr>
      <td height="25" align="middle" bgcolor="#FFFFFF" style="BORDER-TOP: medium none; BORDER-BOTTOM: medium none"><div align="left"><span class="style1"><font size="3"><font size="2">&nbsp;</font></font></span><span class="style1"><font size="3"><font size="2">&nbsp;</font></font></span><span class="style1"><font size="3"><font size="2">&nbsp;</font></font></span>级&nbsp; &nbsp;&nbsp;别：
            <select name="rank" size="1">
                  <option value="3">链接管理员</option>                
                  <option value="2">普通管理员</option>
                  <option value="1">系统管理员</option>
                  
                </select>
      </div></td>
    </tr>        
    <tr>
      <td height="25" bgcolor="#FFFFFF" style="BORDER-TOP: medium none"><p align="center">      
        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><br>&nbsp;&nbsp;&nbsp;
              <input type="submit" value="确认添加" name="B1">
            
              <input type="reset" value="取消添加" name="B1">
            </div><br></td>
            <td>&nbsp;</td>
          </tr><br>
        </table></td>
    </tr>
  </table>
  </center>
  </form>
</div>


 
 <br>
<div align="center">
<%
dick=request("dick")
if dick="del" then
call del()
else%>
</div>
<div align="center">
  <center>
  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#ADAED6" width="100%">
    <tr bgcolor="#BDBEDE">
      <td width="46" height="28" align="center"><font color="#990000">编号</font></td>
      <td width="110" height="28" align="center"><font color="#990000">管理帐号</font></td> 
      <td width="110" height="28" align="center"><font color="#990000">管理级别</font></td>             
      <td width="150" height="28" align="center"><font color="#990000">相关操作</font></td>
    </tr>
<%
dim rs,sql,i,id,dick,deladm
i=1
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select id,adminname,rank from [admin]" 
rs.open sql,conn,1,1
do while not rs.eof
%>
    <tr>
      <td width="46" height="24" align="center" bgcolor="#FAFAFA"><%=i%></td>
      <td width="110" height="24" align="center" bgcolor="#FFFFFF"><div align="left"><span class="style1"><font size="3"><font size="2">&nbsp;</font></font></span><%=rs("adminname")%></div></td>
            <td width="110" height="24" align="center" bgcolor="#FFFFFF"><div align="left"><span class="style1"><font size="3"><font size="2">&nbsp;</font></font></span><%if rs("rank")=1 then%>系统管理员<%else%><%if rs("rank")=2 then%>普通管理员<%else%>链接管理员<%end if%><%end if%></div></td>
      <td width="150" height="24" align="center" bgcolor="#FAFAFA"><a href='admin_pass.asp?admin=<%=rs("adminname")%>'>修改</a>&nbsp;&nbsp;&nbsp;<img border=0 src=../images/delete.gif alt="删除此管理员" style="cursor:hand" onclick="{if(confirm('该操作不可恢复！\n\n确实要删除这个管理员吗？ ')){location.href='admin_add.asp?dick=del&deladm=<%=rs("adminname")%>';}}"></td>
    </tr>
<%
i=i+1
rs.movenext
loop
rs.close
set rs=nothing
sub del()
id=request("id")
deladm=request("deladm")

if deladm=request.cookies(hxCacheName&"_ttlink")("administrator") then
			response.write "<script language='javascript'>"
			response.write "alert('您不能删除自己！');"
			response.write "location.href='admin_add.asp';"
			response.write "</script>"
			response.end
		else
set rs = Server.CreateObject("ADODB.RecordSet")
sql="delete from [admin] where adminname='"&deladm&"'"
rs.open sql,conn,1,3
response.write "<script language=JavaScript>" & chr(13) & "alert('删除帐号成功！');" & "window.location='admin_add.asp'" & "</script>"
response.end
end if
end sub
set rs=nothing
end if
'closedb
%>
  </table>
  </center>
</div>
