www.gusucode.com > 掌柜网店购物系统 4.0码程序 > admin/renpassword.asp

    <!--#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="../img/css.css" rel="stylesheet" type="text/css">
<style>
BODY {
SCROLLBAR-FACE-COLOR: #e7e7e7;  
SCROLLBAR-HIGHLIGHT-COLOR: #ffffff;
SCROLLBAR-SHADOW-COLOR: #d4d0c8;
SCROLLBAR-3DLIGHT-COLOR: #FFFFFF;
SCROLLBAR-ARROW-COLOR:  #ffffff;
SCROLLBAR-TRACK-COLOR: #f7f7f7;
SCROLLBAR-DARKSHADOW-COLOR: #e7e7e7; 
}
.style3 {color: #FF6600}
</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("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
%>
<table class="tableBorder" width="96%" 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" bgcolor="#dfdfdf"><b>更改管理密码</font></b></td>
</tr>
<tr bgcolor="#f2f2f2"> 
<td width="40%" align="right">管理 I D:</td>
<td width="60%">&nbsp;<font color=red><%=session("admin")%></font></td>
</tr>
<tr bgcolor="#f2f2f2"> 
<td align="right">原 密 码:</td>
<td>&nbsp;<input name="password" type="password" id="password" size="16"></td>
</tr>
<tr bgcolor="#f2f2f2"> 
<td align="right">新 密 码:</td>
<td>&nbsp;<input name="password1" type="password" id="password1" size="16"></td>
</tr>
<tr bgcolor="#f2f2f2"> 
<td align="right">确认密码:</td>
<td>&nbsp;<input  name="password2" type="password" id="password2" size="16"></td>
</tr>
<tr bgcolor="#f2f2f2">
<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>