<!--#include file="../../Conn.asp" -->
<!--#include file="../../Comm/Site_Class.asp" -->
<!--#include file="../../Comm/md5.asp" -->
<%
PagePath = "../../"

Set Qsite = New Site_Class

Qsite.SiteConfig_Master()
%>
<!--#include file="../Check_Login.asp" -->
<%
Qsite.Check_AdminFlag(arrAdminFlag(9 , 3))

Dim OldPass,NewPass1,NewPass2

Set Rs = server.createobject("ADODB.Recordset")

If Request.Form <> "" Then
	OldPass = Qsite.chgStr(Trim(Request.Form("OldPass")))
	NewPass1 = Qsite.chgStr(Trim(Request.Form("NewPass1")))
	NewPass2 = Qsite.chgStr(Trim(Request.Form("NewPass2")))
	
	If OldPass = "" Or IsNull(OldPass) Then
		Qsite.ShowMsg "请输入原密码" , ""
	End If
	If NewPass1 = "" Or IsNull(NewPass1) Then
		Qsite.ShowMsg "请输入新密码" , ""
	End If
	If NewPass2 = "" Or IsNull(NewPass2) Then
		Qsite.ShowMsg "请输入确认新密码" , ""
	End If
	If NewPass1 <> NewPass2 Then
		Qsite.ShowMsg "输入的新密码和确认新密码不一致" , ""
	End If
	
	OldPass = MD5(OldPass)
	NewPass1 = MD5(NewPass1)

	Set Rs = Conn.Execute("select * from AdminTbl where AdminPass = '"& OldPass &"' and AdminName = '"& Session("AdminName") &"'")
	If Rs.Eof Then
		Qsite.ShowMsg "输入的原密码不正确" , ""
	Else
		Conn.Execute("update AdminTbl set AdminPass = '"& NewPass1 &"' where AdminName = '"& Session("AdminName") &"'")
		Session("AdminPass") = NewPass1
	End If
	Set Rs = Nothing
	
	Qsite.ShowMsg "登录密码修改成功" , "Admin_ChgPass.asp"
End If
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>修改登录密码</title>
<link href="../skins/css/main.css" rel="stylesheet" type="text/css">
<script language="javascript">
function CheckForm()
{
	if(PosForm.OldPass.value == "")
	{
		alert("请输入原密码");
		PosForm.OldPass.focus();
		return false;
	}
	if(PosForm.NewPass1.value == "")
	{
		alert("请输入新密码");
		PosForm.NewPass1.focus();
		return false;
	}
	if(PosForm.NewPass2.value == "")
	{
		alert("请输入确认新密码");
		PosForm.NewPass2.focus();
		return false;
	}
	if(PosForm.NewPass1.value != PosForm.NewPass2.value)
	{
		alert("输入新密码和确认新密码不一致");
		return false;
	}
	return true;
}
</script>
</head>

<body>
<form name="PosForm" method="post" action="Admin_ChgPass.asp" style="margin:0" onSubmit="return CheckForm();">
	<table width="100%" border="0" cellspacing="1" cellpadding="5">
		<tr>
			<td height="25" colspan="2" class="td_title">修改登录密码</td>
		</tr>
		<tr>
			<td width="18%" height="23" class="td_content">原密码：</td>
			<td width="82%" height="23" class="td_content"><input name="OldPass" type="password" class="input_1" id="OldPass" size="40"></td>
		</tr>
		<tr>
			<td height="23" class="td_content">新密码：</td>
			<td height="23" class="td_content"><input name="NewPass1" type="password" class="input_1" id="NewPass1" size="40"></td>
		</tr>
		<tr>
			<td height="23" class="td_content">确认新密码：</td>
			<td height="23" class="td_content"><input name="NewPass2" type="password" class="input_1" id="NewPass2" size="40"></td>
		</tr>
		<tr>
			<td height="23" class="td_content">&nbsp;</td>
			<td height="23" class="td_content"><input name="Submit" type="submit" class="input_1" value=" 修  改 "> &nbsp;
			<input name="Submit" type="reset" class="input_1" value=" 重  置 "></td>
		</tr>
	</table>
</form>
</body>
</html>
