<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<!--#include file="md5.asp"-->
<!--#include file="../inc/setup.asp"-->
<!--#include file="../inc/sql.asp"-->
<%end if%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="Include/Admin_Style.css" type=text/css rel=stylesheet>
<script type="text/javascript" src="../inc/checkpwd.js"></script>
<script LANGUAGE="javascript">
<!--
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
function check()
{
  if(checkspace(document.renpassword.password.value)) {
	document.renpassword.password.focus();
    alert("原密码不能为空！");
	return false;
  }
  if(checkspace(document.renpassword.password1.value)) {
	document.renpassword.password1.focus();
    alert("新密码不能为空！");
	return false;
  }
    if(checkspace(document.renpassword.password2.value)) {
	document.renpassword.password2.focus();
    alert("确认密码不能为空！");
	return false;
  }
    if(document.renpassword.password1.value != document.renpassword.password2.value) {
	document.renpassword.password1.focus();
	document.renpassword.password1.value = '';
	document.renpassword.password2.value = '';
    alert("新密码和确认密码不相同，请重新输入");
	return false;
  }
 }
//-->
</script>
<style type="text/css">
#pwdpower {
	width:195px;
	border:0px none;
	background-color:#f1f1f1
}
#pwdpower td {
	text-align:center;
	vertical-align:middle;
	padding:1px;
	color:#adadac;
}
#pwdpower #pweak{
	border-right:1px solid #dedede;
}
#pwdpower #pmedium{
	border-right:1px solid #dedede;
}
#pwdpower #pstrong{

}
</style>
</head>
<body>
<%
	if request.QueryString("action")="save" then
	password=Trim(Request.Form("password"))
	password2=Trim(Request.Form("password2"))

		set rs=server.CreateObject("adodb.recordset")
		sql="select * from admin where admin='"&Request.Cookies("job_admin_Name")&"'"
		rs.open sql,conn,2,3
		if md5(password)<>rs("password") then
			response.Write "<script language=javascript>alert('原密码错误，请返回重新输入');window.location.reload('renpassword.asp')</script>"
			response.End
		else
			rs("password")=md5(password2)
			rs.Update
			rs.Close
			set rs=nothing
			Response.Cookies("job_admin_Name")=""
			Response.Cookies("flag")=""
			response.Write "<script language=javascript>alert('更改成功，请用新密码重新登陆！');window.location.reload('login.asp')</script>"
			response.End
		end if
	end if
%> 
<table width="100%" border="1" align="center" cellpadding="5" cellspacing="1" class="sortbutton">
  <tr> 
    <td height="38" align="center"><font color="#000000">更改管理密码</font></td>
  </tr>
  <tr> 
    <td height="163" bgcolor="#FFFFFF"> 
      <table width="351" border="0" align="center" cellpadding="2" cellspacing="1">
        <form name="renpassword" method="post" action="?action=save" onSubmit="return check()">
          <tr> 
            <td width="63" height="33">用户名：</td>
            <td width="275"><font color=red><%=Request.Cookies("job_admin_Name")%></font></td>
          </tr>
          <tr> 
            <td width="63" height="29">原密码：</td>
            <td width="275" align="left"><input name="password" type="password" id="password" size="28"></td>
          </tr>
          <tr> 
            <td width="63" height="29">新密码：</td>
            <td width="275" align="left" valign="middle"><input name="password1" type="password" id="password1" size="28" onChange="javascript:EvalPwd(this.value);" onKeyUp="javascript:EvalPwd(this.value);">
               (大于6位) <br>
<table width="59%" height="20" border="0" cellpadding="0" cellspacing="0" id="pwdpower">
<tr>
<td id="pweak" style="">弱</td>
<td id="pmedium" style="">中</td>
<td id="pstrong" style="">强</td>
</tr>
</table></td>
          </tr>
          <tr> 
            <td width="63" height="31">确认密码：</td>
            <td width="275" align="left"><input  name="password2" type="password" id="password2" size="28">
(大于6位) </td>
          </tr>
          <tr> 
            <td height="41" colspan="2" align="center"><input type="submit" name="Submit" value="确定更改"></td>
          </tr>
        </form>
      </table>
      
    </td>
  </tr>
</table>
<br>
<table width="100%" height="226" border="1" align="center" cellpadding="5" cellspacing="1" class="sortbutton">
  <tr> 
    <td height="42" align="center"><font color="#000000">操作注意事项及说明</font></td>
  </tr>
  <tr> 
    <td height="177" bgcolor="#FFFFFF"> 
      <table width="37%" height="56" border="0" align="center" cellpadding="5" cellspacing="0">
        <tr> 
          <td height="16"><font color="#FF0000">·请牢记您的新密码，修改过后需要重新登陆！</font></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>