<!--#include file="../include/Conn.jsp"-->
<!--#include file="../Include/Char.jsp" -->
<!--#include file="../Include/md5.jsp" -->
<!--#include file="Admin_IsLogin.jsp" -->
<% 
If Request.Querystring("action")="post" Then
 Dim OldPwd,NewPwd,NewPwd2,mUserName
 Dim rs,rsw,mSql
 mUserName=Session.Contents("CurUserName")
 mOldPwd=Trim(Request.Form("txtOldPwd"))
 mNewPwd=Trim(Request.Form("txtNewPwd"))
 mNewPwd2=Trim(Request.Form("txtNewPwd2"))
 mSql="Select F_PassWord From T_Admin Where F_UserName='" & mUserName & "'"
 set Rs=conn.Execute(mSql)
  If rs("F_Password")<>md5(mOldPwd) then
     response.write "<script>alert('旧密码输入错误！');history.back();</Script>"
	 response.end
  else
     Set Rsw=server.createobject("Adodb.recordset")
	 mSql="select F_PassWord from T_Admin Where F_UserName='" & mUserName & "'"
	 Rsw.open mSql,conn,1,3
	 Rsw("F_PassWord")=md5(mNewPwd)
	 Rsw.update
	 Rsw.close
	 set Rsw=Nothing
     response.write "<script>alert('密码修改成功！');history.back();</Script>"
  end if
end if
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/Style.css" rel="stylesheet" type="text/css">
<script language="javascript">
  function checkdata()
  {
  if (document.all.txtOldPwd.value=="") 
     {
	  alert("密码不能为空，请输入旧密码！")
	  document.all.txtOldPwd.focus()
	  return false;
	 }
    if (document.form1.txtNewPwd.value=="") 
     {
	  alert("密码不能为空，请输入新密码！")
	  document.form1.txtNewPwd.focus()
	  return false;
	 }
  if (document.form1.txtNewPwd2.value=="") 
     {
	  alert("密码不能为空，请输入确认密码！")
	  document.form1.txtNewPwd2.focus()
	  return false;
	 }
  
  
  if (document.form1.txtNewPwd.value!=document.form1.txtNewPwd2.value)
    {
	  alert("您两次输入的密码不一致，请重新输入!");
	  document.form1.txtNewPwd.focus();
	  return false;
	}

 }
</script>
</head>
<BODY leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">
<%
	admin_flag=",0|4|0,"
	if instr(session("flag"),admin_flag)=0 or isnull(session("flag"))=true then
	Response.write "<br><br><br><br><b><font color=red>对不起，您没有管理本页面的权限!</font></B>"
	Response.end
	end if
%>

<br>
<TABLE class=tableBorder cellSpacing=1 cellPadding=3 width="95%" align=center 
border=0>
  <TBODY>
    <TR> 
      <TH width="100" height=25 align="center" class=tableHeaderText>操作提示</TH>
    </TR>
    <TR> 
      <TD class=forumrow> <P><B>注意</B>：<BR>
          如果您想更改密码，请先输入旧密码，然后再输入新密码及确认密码。新密码和确认密码必须一致<BR>
        </P></TD>
    </TR>
  </TBODY>
</TABLE>
<form name="form1" method="post" action="Admin_ModifyPassword.jsp?action=post" onSubmit="return checkdata()">
<table class=tableBorder width="95%" border=0 align="center" cellpadding=5 cellspacing=1>
  <tbody>
    <tr> 
        <th height=21 colspan="2" sytle="line-height:150%">【修改密码】</th>
    </tr>
    <tr> 
      <td width="15%"  class=forumRow>输入旧密码：</td>
      <td width="85%"  class=forumRowHighlight><input class="INPUT" type="password" name="txtOldPwd"></td>
    </tr>
    <tr> 
      <td class=forumRow>输入新密码：</td>
      <td class=forumRowHighlight><input class="INPUT" type="password" name="txtNewPwd"></td>
    </tr>
    <tr> 
      <td class=forumRow>新密码确认：</td>
      <td class=forumRowHighlight><input class="INPUT" type="password" name="txtNewPwd2"></td>
    </tr>
    <tr>
      <td class=forumRow>&nbsp;</td>
      <td class=forumRowHighlight> <input type="submit" value="提交信息" name="B32" > 
        &nbsp; <input type="reset" value="从新来过" name="B32" ></td>
    </tr>
  </tbody>
</table>
</form>
<P></P>
</body>
</html>
