<!--#include file="conn.asp"-->
<%if session("bjxadmin")="" 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="../images/css.css" rel="stylesheet" type="text/css">
<style><!--
body,td,th {
	color: #000000;
}
body {
	background-color: #C7D4F7;
}
-->
</style></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("bjxadmin")&"'",conn,1,3
if md5(trim(request("password")),16)<>rs("password") then
response.Write "<script language=javascript>alert('原密码错误，请返回重新输入');history.go(-1);</script>"
response.End
else
rs("password")=md5(trim(request("password2")),16)
rs.Update
rs.Close
set rs=nothing
session("bjxadmin")=""
session("flag")=""
response.Write "<script language=javascript>alert('更改成功，请用新密码重新登陆！');history.go(-1);</script>"
end if
response.End
end if
%>
<table class="tableBorder" width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<form name="renpassword" method="post" action="renpassword.asp?action=save">
<tr> 
<td colspan="2" align="center" background="../images/admin_bg_1.gif"><b><font color="#ffffff">更改管理密码</font></b></td>
</tr>
<tr > 
<td width="40%" align="right">管理 I D：</td>
<td width="60%">&nbsp;<font color=red><%=session("bjxadmin")%></font></td>
</tr>
<tr > 
<td align="right">原 密 码：</td>
<td>&nbsp;<input name="password" type="password" id="password" size="16"></td>
</tr>
<tr > 
<td align="right">新 密 码：</td>
<td>&nbsp;<input name="password1" type="password" id="password1" size="16"></td>
</tr>
<tr > 
<td align="right">确认密码：</td>
<td>&nbsp;<input  name="password2" type="password" id="password2" size="16"></td>
</tr>
<tr >
<td></td>
<td>&nbsp;<input onClick="return check();" type="submit" name="Submit" value="确定更改">
</td>
</tr>
</form>
</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> 