updatepwd.asp
来自「实验教学系统 很好用 有学生 老师 管理等模块 便于学校使用」· ASP 代码 · 共 83 行
ASP
83 行
<!--#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>
<br>
<table width="607" border="0" align="center">
<tr>
<td width="605" align="center" bgcolor="#FFFFFF">
<table width="90%" border="0">
<tr>
<td height="40" align="center"><h3><font color="#AB0000">修改密码</font></h3></td>
</tr>
<tr>
<td height="30"><hr size="1" noshade></td>
</tr>
</table>
<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.Redirect "../index.asp"
End If
%>
<td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?