<%if session("admin")="" then
response.write"你没有登陆或是非法用户!<meta http-equiv=refresh content='1;url=../index.asp'>"
response.End()
end if
if session("adminl")<>"0" then
response.write"你没有操作权限!<meta http-equiv=refresh content='1;url=r.asp'>"
response.End()
end if
%>
<!--#include file=conn.asp-->
<!--#include file="../config.asp"-->
<!--#include file="../md5.asp"-->
<head>
<link href=../iknow.css rel=stylesheet type=text/css>
<style type="text/css">

</style>
</head>
<table width="80%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000" height="194">
  <tr>
    <td width="50%" align="center" bgcolor="#FFFFFF" height="82" valign="top">
	<%if request("up")="修改" then
	if request("adminpwd")="" then
	response.write"密码不能为空!<meta http-equiv=refresh content='1;url=adminadmin.asp'>"
	response.End()
	else
	rs.open"select * from admin where adminname='"&session("admin")&"'",conn,1,3
	rs("adminpwd")=md5(request("adminpwd"))
	rs.update
	response.write"密码修改成功!<meta http-equiv=refresh content='1;url=adminadmin.asp'>"
	response.End()
	end if
	end if%>
	<form method=post action=adminadmin.asp>
	<table width="100%"  border="0" cellspacing="0" cellpadding="0" height="65">
      <tr>
        <td align="center" bgcolor="eeeeee" height="20">管理员修改密码</td>
      </tr>
      <tr>
        <td align="center" height="45">新密码：<input name="adminpwd" type="password" id="adminpwd" size="12">
          <input name="up" type="submit" id="up" value="修改"></td>   
      </tr>
    </table>
	</form>
	</td>
    <td bgcolor="#FFFFFF" height="82" width="50%" valign="top">
	<%if request("add")="添加" then
	if request("adminname")="" then
	response.write"帐号不能为空!<meta http-equiv=refresh content='1;url=adminadmin.asp'>"
	response.End()
	if request("pass")="" then
	response.write"密码不能为空!<meta http-equiv=refresh content='1;url=adminadmin.asp'>"
	response.End()
	end if
	if request("adminl")="" then
	response.write"权限不能为空!<meta http-equiv=refresh content='1;url=adminadmin.asp'>"
	response.End()
	end if
	else
	rs.open"select * from admin where adminname='"&request("adminname")&"'",conn,1,1
	if not rs.eof then
	rs.close
	response.write"该帐号已经存在!<meta http-equiv=refresh content='1;url=adminadmin.asp'>"
	response.End()
	else
	rs.close
	rs.open"select * from admin",conn,1,3
	rs.addnew
	rs("adminname")=request("adminname")
	rs("adminpwd")=md5(request("pass"))
	rs("adminl")=request("adminl")
	rs.update
	rs.close
	response.write"管理员添加成功!<meta http-equiv=refresh content='1;url=adminadmin.asp'>"
	response.End()
	end if
	end if
	end if
	%>
	<form method=post action=adminadmin.asp>
	<table width="100%"  border="0" cellspacing="0" cellpadding="0" height="74">
      <tr>
        <td align="center" bgcolor="eeeeee" width="383" colspan="2" height="20">添加管理员
          </td>
      </tr>
      <tr>
        <td align="center" width="98" height="54">
          <p align="left"></p>
</td>  
        <td align="center" width="287" height="54">
          <p align="left">帐号：<input name="adminname" type="text" id="adminname" size="12">
          &nbsp;<br>密码：<input name="pass" type="password" id="pass" size="12">&nbsp;<br>级别：<select size="1" name="adminl">
    <option value="0" selected>系统管理员</option>
    <option value="1">一般管理员</option>
  </select>&nbsp;<input name="add" type="submit" id="add" value="添加">    
</td>  
      </tr>
    </table>
	</form>
	</td>
  </tr>
  <tr>
    <td width="50%" align="center" bgcolor="#FFFFFF" height="108" colspan="2">
<%if request("del")="删除" then
rs2.open"select * from admin where id="&request("id")&"",conn,1,3
rs2.delete
rs2.close
end if
%>
    <table border="1" width="154" height="33" cellspacing="0" bordercolorlight="#000000" cellpadding="0" bordercolordark="#FFFFFF">
      <tr>
        <td width="121" height="1" bgcolor="#EEEEEE">
          <p align="center">管理员</td>
        <td width="54" height="1" bgcolor="#EEEEEE">
          <p align="center">删除</td>
      </tr>
      <%rs2.open"select * from admin",conn,1,1
      while not rs2.eof
      %><tr><form method=post action=adminadmin.asp><input type=hidden name="id" value=<%=rs2("id")%>>
        <td width="121" height="29"><%=rs2("adminname")%></td>
        <td width="54" height="29">
          <p align="center"><input name="del" type="submit" id="del" value="删除"></form><%
      rs2.movenext
	  wend
      rs2.close%></tr>
    </table>
	</td>
  </tr>
</table>
