<% Option Explicit %>
<!--#include file="../../Inc/Const.asp" -->
<!--#include file="../../Inc/Cls_DB.asp" -->
<!--#include file="../../Inc/Md5.asp" -->
<%
Dim DBC,Conn
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
%>
<!--#include file="../../Inc/Session.asp" -->
<!--#include file="../../Inc/CheckPopedom.asp" -->
<%
if Not JudgePopedomTF(Session("Name"),"P0805") then Call ReturnError1()

if request.Form("action")="add" then
	if request.Form("PassWord")="" then
		Response.Write("<script>alert(""错误：\n请填写密码"&Copyright&""");location.href=""ChangePwd.asp"";</script>")
		Response.End
	end if
	if len(request.Form("PassWord"))<6 then
		Response.Write("<script>alert(""错误：\n密码不能少于6个字符"&Copyright&""");location.href=""ChangePwd.asp"";</script>")
		Response.End
	end if
	if request.Form("PassWord")<>request.Form("AffirmPassWord") then
		Response.Write("<script>alert(""错误：\n2次密码不相同"&Copyright&""");location.href=""ChangePwd.asp"";</script>")
		Response.End
	end if
	dim Rs,SQL
	set Rs = server.CreateObject ("ADODB.RecordSet")
	SQL="select * from admin where id="&cint(request.Form("id"))&" and name='"&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="../../css/css.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>
