<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/Commoncode.asp"-->
<!--#include file="../checkvalid.asp"-->
<!--#include file="../../inc/md5.asp"-->
<%
if request("action")="save" then
user=request("user")
passa=request("passa")
pass=request("pass")

set rs=server.createobject("adodb.recordset")
sql="select * from JOB_admin where JOB_user='"&user&"'"
	rs.open sql,conn,1,3
 	if not(rs.bof and rs.eof) then
 		if md5(passa,32)<>rs("JOB_pass") then
	response.write "<script>alert('原始密码有误，请重新输入');history.go(-1);</script>"
	Response.End 
 		else
			rs("JOB_pass")=md5(pass,32)
			rs.update
			rs.close
			set rs=nothing
            call success()
			Response.Cookies("admin_pass")=md5(pass,32)   '更新加密密码
			response.end
 		end if
	else
	response.write "<script>alert('此管理员不存在，请重新输入');history.go(-1);</script>"
	Response.End 
	end if
end if%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/style<%=sk%>.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../inc/input.js"></script><script language="javascript">
function fnRemoveBrank(strSource)
{
 return strSource.replace(/^\s*/,'').replace(/\s*$/,'');
}
function Juge(theForm)
{

  if (fnRemoveBrank(theForm.passa.value) == "")
  {
    alert("请输入原始密码!");
    theForm.passa.focus();
    return (false);
  }
    if (fnRemoveBrank(theForm.pass.value) == "")
  {
    alert("请输入新密码!");
    theForm.pass.focus();
    return (false);
  }
    if (fnRemoveBrank(theForm.pass1.value) == "")
  {
    alert("请输入确认密码!");
    theForm.pass1.focus();
    return (false);
  }
  if (theForm.pass.value !=theForm.pass1.value)
  {
    alert("两次密码输入不一致，请重新确认密码!");
    theForm.pass.focus();
    return (false);
  }
return true;
}
</script></head>
<body>
<br>

<table width="95%" height="0" border="0" align="center" cellpadding="2" cellspacing="1" class="tableBorder">
  <form name="form1" method="post" action="admin_changepass.asp?action=save" onSubmit="return Juge(this)">
    <tr> 
    <th class="tableHeaderText" colspan=2 height=25>修改管理员密码</th>
    </tr>
    <tr> 
      <td width="18%" height="30" align="center">用 户 名</td>
      <td width="82%">　
      <input name="user" type="text" value="<%=Request.Cookies("admin_name")%>" size=20 readonly style="width:150" ></td>
    </tr>
    <tr> 
      <td width="18%" height="30" align="center">原始密码</td>
      <td width="82%">　
      <input name="passa" type="password" size=20 style="width:150"></td>
    </tr>
    <tr> 
      <td width="18%" height="30" align="center">新 密 码</td>
      <td width="82%">　
      <input name="pass" type="password" size=20 style="width:150"></td>
    </tr>
    <tr> 
      <td width="18%" height="30" align="center">确认密码</td>
      <td width="82%">　
      <input name="pass1" type="password" size=20 style="width:150"></td>
    </tr>
    <tr align="center"> 
      <td height="30" colspan=2><input type="submit" name="Submit" value="提 交" class=inputs></td>
    </tr>
  </form>
</table>
<!--#include file="../inc/copy.asp" -->
</body>
</html>
<%sub success()%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/style<%=sk%>.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../inc/input.js"></script><title>操作成功</title>
</head>
<body>
<table cellpadding=2 cellspacing=1 border=0 width=400 class=tableBorder align=center><TR>
  <TH class=tableHeaderText colSpan=2 height=25>修改管理员密码</TH>
<TR><tr><td height=85 valign=top class=forumRow><div align=center><br><br>
修改密码成功！</div></td></tr><tr align=center><td height=30 class=forumRowHighlight><a href='admin_changepass.asp'>&lt;&lt; 返回上一页</a></td></tr></table>
<!--#include file="../inc/copy.asp" -->
</body>
</html>
<%end sub%>