📄 updatepwd.asp
字号:
<%
'这是安全模块,如果客户不是管理员用户,立即重定向到首页.
'这样可以防止某些客户直接访问admin下面的文件。
If Session("UserType")<>"A" Then
Response.Redirect "../index.asp"
End If
%>
<!--#INCLUDE FILE="../odbc_connection2.asp"-->
<html>
<head>
<title>修改密码</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
<!--
function check_Null(){
if (document.form1.oldpassword.value==""){
alert("旧密码不能为空!");
return false;
}
if (document.form1.newpassword.value==""){
alert("新密码不能为空!");
return false;
}
if (document.form1.newpassword.value!=document.form1.newpassword2.value){
alert("密码和密码确认必须一致!");
return false;
}
return true;
}
// -->
</script>
</head>
<body>
<h2 align="center">修改密码</h2>
<center>
<form name="form1" onsubmit="javascript: return check_Null();" action="" method="post">
<table width="80%" border="0" cellPadding="4" cellSpacing=1 borderColorLight="#cccccc" borderColorDark="#ffffff" bgcolor="#999999">
<tr bgcolor="#FFFFFF">
<td height="25">旧 密 码</td>
<td><input type=password size=15 name="oldpassword">*</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25">新 密 码</td>
<td><input type=password size=15 name="newpassword">*</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25">确认密码</td>
<td><input type=password size=15 name="newpassword2">*</td>
</tr>
</table>
<p align="center">
<input type="submit" value=" 确 定 " name="submit" class="inputbutton">
</form>
<%
If Request.Form("oldpassword")<>"" And Request.Form("newpassword")<>"" Then
'下面先判断旧密码是否正确
dim strSql,rs
strSql="Select password From users Where UserId='" & session("UserId") & "'"
Set rs=db.Execute(strSql)
If rs("password")<>Request.Form("oldpassword") Then
Response.Write "对不起,旧密码不正确,请重新输入!"
Response.End
End If
'下面更新密码
strSql="Update users Set password='" & Request.Form("newpassword") & "'"
strSql=strSql & " Where UserId='" & Session("UserId") & "'"
db.Execute(strSql)
'关闭对象
db.close
set db=nothing
'修改密码成功
Response.Write "已经成功修改密码!"
End If
%>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -