<!--#include file="conn.asp"-->
<%if session("admin")="" then
response.Write "<script language='javascript'>alert('网络超时或您还没有登陆！');window.location.href='login.asp';</script>"
response.End
end if
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css.css" rel="stylesheet" type="text/css">
</head>
<body>
<%if request.QueryString("action")="save" then%>
<!--#include file="../md5.asp"-->
<%
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from shop_admin where admin='"&session("admin")&"'",conn,1,3
if md5(trim(request("password")))<>rs("password") then
response.Write "<script language=javascript>alert('原密码错误，请返回重新输入');history.go(-1);</script>"
response.End
else
rs("password")=md5(trim(request("password2")))
rs.Update
rs.Close
set rs=nothing
session("admin")=""
session("flag")=""
response.Write "<script language=javascript>alert('更改成功，请用新密码重新登陆！');history.go(-1);</script>"
end if
response.End
end if
%>
<br><table width="95%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
  <tr> 
    <td height="22" bgcolor="f1f1f1"> 
      <div align="center"><font color="#000000">更改管理密码</font></div>
    </td>
  </tr>
  <tr> 
    <td height="163" bgcolor="#FFFFFF"> 
      <table width="220" border="0" align="center" cellpadding="0" cellspacing="5">
        <form name="renpassword" method="post" action="renpassword.asp?action=save">
          <tr> 
            <td width="64"> 
              <div align="left">用户名：</div>
            </td>
            <td width="145"> 
              <div align="center"><font color=red><%=session("admin")%></font></div>
            </td>
          </tr>
          <tr> 
            <td> 
              <div align="left">原密码：</div>
            </td>
            <td> 
              <div align="center"> 
                <input name="password" class="wenbenkuang" type="password" id="password" size="12">
              </div>
            </td>
          </tr>
          <tr> 
            <td> 
              <div align="left">新密码：</div>
            </td>
            <td> 
              <div align="center"> 
                <input name="password1" class="wenbenkuang" type="password" id="password1" size="12">
              </div>
            </td>
          </tr>
          <tr> 
            <td> 
              <div align="left">确认密码：</div>
            </td>
            <td> 
              <div align="center"> 
                <input  name="password2" class="wenbenkuang" type="password" id="password2" size="12">
              </div>
            </td>
          </tr>
          <tr> 
            <td colspan="2"> 
              <div align="center"> 
                <input onClick="return check();" type="submit" name="Submit" class="go-wenbenkuang" value="确定更改">
              </div>
            </td>
          </tr>
        </form>
      </table>
    </td>
  </tr>
</table>
<br>
<table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td  rowspan="2"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="12v">
              <tr> 
                <td class="12v" > 
                  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber3" height="0" width="100%">
                    <tr> 
                      <td> 
                        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                          <tr> 
                            <td> 
                              <div align="center"><font color="#000000">操作注意事项及说明</font></div>
                            </td>
                          </tr>
                          <tr> 
                            <td height="24"> 
                              <table width="80%" border="0" align="center" cellpadding="5" cellspacing="0">
                                <tr> 
                                  <td height="16"><font color="#FF0000">·请牢记您的新密码，修改过后需要重新登陆！</font></td>
                                </tr>
                              </table>
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<!--#include file="copyright.asp"-->
</body>
</html>
<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;
  }
	document.admininfo.submit();
  }
//-->
</script> 
