stu表 字段有id,password
stupass1.asp页面
<form method="post" name="formpass" action="stupass2.asp">
<table width="39%" height="100" align="center">
<tr>
<td width="40%" align="right">原密码:</td>
<td width="60%"><input name="password" type="password" id="password"></td>
</tr>
<tr>
<td width="40%" align="right">新密码:</td>
<td width="60%"><input name="newpassword" type="password" id="newpassword"></td>
</tr>
<tr>
<td align="right">确认密码:</td>
<td><input name="newpasswordtemp" type="password" id="newpasswordtemp"></td>
</tr>
<tr>
<td> </td>
<td>
<input type="submit" name="submit" value="提交">
<input type="reset" name="rt" value="重置">
<input type="submit" name="submit" value="返回">
</td>
</tr>
</table>
</form>
stupass2页面
<!--#include file="conn.asp"-->
<%
dim password,newpassword,newpasswordtemp,stuid
if Request.Form("submit")="提交" then
stuid = session("stuid")
password = Request("password")
newpassword = Request("newpassword")
newpasswordtemp = Request("newpasswordtemp")
if session("password") <> password then
Response.Write "<center>对不起,您输入的旧密码不正确.请重试!</center>"
Response.end
elseif newpassword <> newpasswordtemp then
Response.Write "<center>对不起,新密码与新密码确认不同.请重试!</center>"
Response.end
end if
dim rs,sql
Set rs=server.CreateObject("ADODB.Recordset")
sql="update stu set password='"&newpassword&"' where id="&stuid
conn.execute(sql)
Response.Write "<center>密码修改成功,请切记您的新密码:'"&newpassword&"'</center>"
Response.end
elseif Request.Form("submit")="返回" then
Response.Redirect "sturight.asp"
end if
%>
stupass1.asp页面
<form method="post" name="formpass" action="stupass2.asp">
<table width="39%" height="100" align="center">
<tr>
<td width="40%" align="right">原密码:</td>
<td width="60%"><input name="password" type="password" id="password"></td>
</tr>
<tr>
<td width="40%" align="right">新密码:</td>
<td width="60%"><input name="newpassword" type="password" id="newpassword"></td>
</tr>
<tr>
<td align="right">确认密码:</td>
<td><input name="newpasswordtemp" type="password" id="newpasswordtemp"></td>
</tr>
<tr>
<td> </td>
<td>
<input type="submit" name="submit" value="提交">
<input type="reset" name="rt" value="重置">
<input type="submit" name="submit" value="返回">
</td>
</tr>
</table>
</form>
stupass2页面
<!--#include file="conn.asp"-->
<%
dim password,newpassword,newpasswordtemp,stuid
if Request.Form("submit")="提交" then
stuid = session("stuid")
password = Request("password")
newpassword = Request("newpassword")
newpasswordtemp = Request("newpasswordtemp")
if session("password") <> password then
Response.Write "<center>对不起,您输入的旧密码不正确.请重试!</center>"
Response.end
elseif newpassword <> newpasswordtemp then
Response.Write "<center>对不起,新密码与新密码确认不同.请重试!</center>"
Response.end
end if
dim rs,sql
Set rs=server.CreateObject("ADODB.Recordset")
sql="update stu set password='"&newpassword&"' where id="&stuid
conn.execute(sql)
Response.Write "<center>密码修改成功,请切记您的新密码:'"&newpassword&"'</center>"
Response.end
elseif Request.Form("submit")="返回" then
Response.Redirect "sturight.asp"
end if
%>