
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--#include file="../inc/Conn.asp"-->
<!--#include file="Inc/Admin.Asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="inc/function.asp"-->
<%

if Request.QueryString("action")="Edit" then
id=request("id")
OldPassword=replace(trim(Request("OldPassword")),"'","")
NewPassword=replace(trim(Request("NewPassword")),"'","")

if strLength(NewPassword)>16 or strLength(NewPassword)<6 then
  response.write  "<script language=javascript>alert('请输入的密码位数不能小于6位或大于16位!');history.go(-1);</script>"
  response.End
end if

set rs=server.createobject("adodb.recordset")
sql="select * from admin where Id="&id
rs.open sql,conn,1,3

'更新管理员密码
if md5(OldPassword)<>rs("PassWord")  then
  response.write  "<script language=javascript>alert('原密码错误，请返回重新输入!');history.go(-1);</script>"
  response.End
else    
  rs("PassWord")=md5(NewPassword)
end if  
rs.update
rs.close
response.redirect "Admin_Manage.asp"
end if
%>


<%
id=request("id")
set rs=server.createobject("adodb.recordset")
sql="select * from admin where id=" & id
rs.open sql,conn,1,1
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>管理员</title>
<link href="css/adminstyle.css" rel="stylesheet" type="text/css">
<SCRIPT language=javascript>
<!--
function myform_onsubmit()
{
if (document.myform.NewPassword.value!=document.myform.ConPassword.value)
{
alert ("新密码和确认密码不一致。");
document.myform.NewPassword.value='';
document.myform.ConPassword.value='';
document.myform.NewPassword.focus();
return false;
}
}
//-->
</SCRIPT>
</head>

<body>
<div class="container">
	<div class="local"><h3>您现在的位置：<a href="admin_Index_Main.asp">管理首页</a> >> 用户管理 >> 修改密码</h3></div>
	<table width="100%" border="0" cellpadding="10" cellspacing="0" class="border" style="margin-top:10px;">
		<tr>
			<td>
			<div class="page_content">
				<div class="r_title"><h3><img src="images/xiao.jpg" /> 修改密码</h3></div>
				<div class="contents">
				<FORM name=myform  onsubmit="return myform_onsubmit()" action="Admin_ManageEdit.asp?action=Edit" method=post><br />
                  <table  width="100%" border="0" cellpadding="0" cellspacing="1" style="border:1px solid #F9EFF0;" align="center">
				<input type=hidden name=id value=<%=id%>>         
					<tr> 
					  <td height="25">管理员帐号：<%=rs("UserName")%></td>
					</tr>
					<tr> 
						<td height="40" colspan="2" bgcolor="#F9EFF0" class="Title">&nbsp;&nbsp;旧密码：<input name="OldPassword" type="password" size="20" maxlength="20">&nbsp;新密码：<input name="NewPassword" type="password" size="20" maxlength="20">&nbsp;密码确认：<input name="ConPassword" type="password" size="20" maxlength="20">&nbsp;<input  type=submit value='修改' name=Submit2></td>
					</tr>
				</table>
				</form>
				</div>
			</div>
			</td>
		</tr>
	</table>
</div>
</body>
</html>
