📄 chanpass.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!-- #INCLUDE FILE = "conn.asp" -->
<!-- #INCLUDE FILE = "MD5.asp" -->
<!-- #INCLUDE FILE = "session.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
color: #FFFFFF;
font-weight: bold;
}
-->
</style>
</head>
<%
dim act,username,oldpass,newpass,newpassconfirm
act=request.QueryString("act")
if(act<>"" and act="mod") then
username=request.Form("username")
oldpass=md5(request.Form("oldpass"),32)
newpass=md5(request.Form("newpass"),32)
newpassconfirm=md5(request.Form("newpassconfirm"),32)
if(newpassconfirm<>newpass) then
response.Write("两次输入的密码不同")
response.Write("<br><a href=""javascript:history.back();"">返回</a>")
response.End()
end if
Set rs=Server.CreateObject("ADODB.Recordset")
rs.open "select * from t_admin where adminname='"&username&"' and adminpass='"&oldpass&"'",conn,3,3
if not rs.eof then
rs("adminpass")=newpass
rs.update
rs.close
set rs=nothing
session("admin")=empty
response.Write("<script>alert(""成功修改密码!系统将返回至登录页面"");location.href='login.asp';</script>")
else
response.Write("你的旧密码不正确!")
response.Write("<br><a href=""javascript:history.back();"">返回</a>")
rs.close
set rs=nothing
response.End()
end if
else
%>
<body>
<script language="javascript">
function check(obj){
with(obj){
if(username.value==""){
alert("用户名不能为空!");
username.focus();
username.select();
return false;
}
if(oldpass.value==""){
alert("原有密码不能为空!");
oldpass.focus();
oldpass.select();
return false;
}
if(newpass.value==""){
alert("请确定您的新密码!");
newpass.focus();
newpass.select();
return false;
}
if(newpassconfirm.value==""){
alert("请确认您的密码!");
newpassconfirm.focus();
newpassconfirm.select();
return false;
}
if(newpass.value!=newpassconfirm.value){
alert("两次输入的密码不同!");
newpass.focus();
newpass.select();
return false;
}
return true;
}
}
</script>
<form id="form1" name="form1" method="post" action="?act=mod" onsubmit="return check(this)">
<table width="600" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#E7E7E7">
<tr>
<td height="22" colspan="2" bgcolor="#006699"><div align="center" class="style1">修改密码</div></td>
</tr>
<tr>
<td width="300" height="30" bgcolor="#FFFFFF"><div align="right">用户名:</div></td>
<td width="300" bgcolor="#FFFFFF"><input name="username" type="text" id="username" size="20" value="" /></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><div align="right">旧密码:</div></td>
<td height="30" bgcolor="#FFFFFF"><input name="oldpass" type="password" id="oldpass" size="20" /></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><div align="right">新密码:</div></td>
<td height="30" bgcolor="#FFFFFF"><input name="newpass" type="password" id="newpass" size="20" /></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><div align="right">确认密码:</div></td>
<td height="30" bgcolor="#FFFFFF"><input name="newpassconfirm" type="password" id="newpassconfirm" size="20" /></td>
</tr>
<tr>
<td colspan="2" bgcolor="#FFFFFF"><div align="center">
<input type="submit" name="Submit" value="修改" />
<input type="reset" name="Submit2" value="取消" />
</div></td>
</tr>
</table>
</form>
<%
end if
%>
</body>
</html>
<%
call connclose()
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -