<!--#include file="../inc/conn.asp" -->
<!--#include file="../Inc/config.asp" -->
<!--#include file="../Inc/Md5.asp" -->
<!--#include file="../Inc/Enpas.asp" -->
<!-- #include file="inc/Session.asp" -->
<%
set rs=server.createobject("adodb.recordset")
rs.open "select RoleId from admin where UserName='"&UserName&"'",conn,3,1
if not rs.eof then
	if(Cint(rs(0))=0) then'如果是超级管理员
	else
		response.Write("您没有权限操作!")
		response.end()
	end if
else
	response.Write("您没有权限操作!")
	response.end()
end if
rs.close
set rs=nothing
if request.Form("action")="add" then
	if request.Form("PassWord")="" then
		Response.Write("<script>alert(""错误：\n请填写密码"&Copyright&""");history.back();</script>")
		Response.End
	end if
	if len(request.Form("PassWord"))<6 then
		Response.Write("<script>alert(""错误：\n密码不能少于6个字符"&Copyright&""");history.back();</script>")
		Response.End
	end if
	if request.Form("PassWord")<>request.Form("AffirmPassWord") then
		Response.Write("<script>alert(""错误：\n2次密码不相同"&Copyright&""");history.back();</script>")
		Response.End
	end if
	
	set Rs = server.CreateObject ("ADODB.RecordSet")
	SQL="select * from admin where UserName='"&request.Form("AdminName")&"'"
	Rs.Open SQL,Conn,3,3
	Rs("PassWord")=md5((request.Form("PassWord")),16)
	Rs.update
	Rs.close
	Set Rs=nothing
	Response.Write("<script>alert(""恭喜!：\n密码更改成功,将返回登陆页面"&Copyright&""");top.location.href=""Login.asp"";</script>")
	Response.End
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>
</head>
<link href="cs.css" rel="stylesheet">
<body>
<div align="center">
  <table width="59%" border="0" cellspacing="0" cellpadding="0">
    <form action="" method="post" name="PassWordForm">
      <tr> 
        <td height="53" colspan="2">&nbsp;</td>
      </tr>
      <tr> 
        <td colspan="2"> &nbsp;&nbsp;&nbsp; <div align="center">新 密 码 
            <input name="PassWord" type="password" id="PassWord" size="30" >
            <br>
            <br>
            确认密码 
            <input name="AffirmPassWord" type="password" id="AffirmPassWord"  size="30">
          </div></td>
      </tr>
      <tr> 
        <td height="50" colspan="2"> <div align="center"> 
            <input type="submit" name="Submit" value=" 确 定 ">
            <input name="AdminName" type="hidden" id="AdminName" value="<%=session("name")%>">
            <input name="id" type="hidden" id="id" value="<%=Session("AdminID")%>">
            <input name="action" type="hidden" id="action" value="add">
            <input type="button" onClick="window.close();" name="Submit2" value=" 取 消 ">
          </div></td>
      </tr>
    </form>
  </table>
</div>
</body>
</html>
<%
call connclose()
%>