修改密码问题
下面修改密码程序为什么实现不了,运行没有错误,但是点击修改后,又回到修改页面,什么都没显示,后台数据也没有变化。本人刚接触asp不久,还有很多不懂,请各位老师帮看一看,在此先谢过!<!--#include file="conn.asp"--> <!--调用conn.asp文件中的内容-->
<SCRIPT language=javascript>
function form1_onsubmit()
{
if(document.form1.oldpass.value.length<1)
{
alert("请输入原密码!");
document.form.oldpass.focus();
return false;
}
if(document.form1.newpass.value.length<1)
{
alert("请输入新密码!");
document.form1.newpass.focus();
return false;
}
if(document.form1.confirmpass.value.length<1)
{
alert("请确定新密码!");
document.form1.confirmpass.focus();
return false;
}
}
</SCRIPT>
<%
uid=Session("admin")
If request.Form("action")="修改" then
oldpass=request.form("oldpass")
newpass=request.form("newpass")
confirmpass=request.form("confirmpass")
if newpass=confirmpass then
sql="select * from [admin] where name_id='"&uid& "'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,3
if oldpass=rs("password") then
rs("password")=newpass
rs.update
response.write ("<script language=javascript>{window.alert('修改成功!');location.href='person.asp';}</script>")
else
Response.Write("<script language=javascript>alert(' 原 始 密 码 不 正 确 ! 请 重 新 输 入 !');history.go(-1);</script>")
response.End
end if
end if
else
set rs=server.createobject("adodb.recordset")
sqltext="select * from [admin] where name_id='"&uid& "'"
rs.open sqltext,conn,3,3
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="Styles.css">
<title>个人信息中心</title>
</head>
<body background="images/right.jpg">
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0 >
<TR>
<TD noWrap width="49%" height=20 align=center bgcolor="#A8CBF1"> <p>
<font face="华文行楷" size=5><b>个人信息管理</b></font></TD>
</tr>
<tr>
<TD height=40 align= left bgcolor="#A8CBF1"> <b><font size=4>相关操作:</font> <a href="edit.asp"><font size="3">修改个人信息</font></a> <a href="editpass.asp"><font size="3">修改密码</font></a></b></TD>
</TR></TABLE>
<br>
<TABLE cellSpacing=1 cellPadding=1 width="58%" align=center>
<TR>
<TD noWrap width="97%" height=50 align=center bgcolor="#A8CBF1"> <font face="华文行楷" size=5><b>修改密码</b></font></TD>
</tr>
</table>
<TABLE cellSpacing=1 cellPadding=1 width="58%" align=center border=0 height="209" >
<form method="POST" action="" name=form1 onSubmit="return form1_onsubmit()">
<tr height="30">
<td width="36%" bgcolor="#E9F4FF" align="right"><font size="4">用户名:</font></td>
<td width="61%" bgcolor="#E9F4FF"><%=rs("name_id")%></td>
</tr>
<tr height="30">
<td width="36%" align="right" bgcolor="#E9F4FF"><font size="4">原密码:</font></td>
<td width="61%" bgcolor="#E9F4FF"><input type="password " name="oldpass" value="" size="35" style=" font-size: 12pt; height: 30; width: 254"></td>
</tr>
<tr height="30">
<td width="36%" bgcolor="#E9F4FF" align="right"><font size="4">新设密码:</font></td>
<td width="61%" bgcolor="#E9F4FF"> <input type="password" name="newpass" value="" size="35" style=" font-size: 12pt; height: 30; width: 254"></td>
</tr>
<tr height="30">
<td width="36%" bgcolor="#E9F4FF" align="right"><font size="4">确认密码:</font></td>
<td width="61%" bgcolor="#E9F4FF"><input type="password" name="confirmpass" value="" size="35" style=" font-size: 12pt; height: 30; width: 254"></td>
</tr>
<tr height="30">
<td bgcolor="#E9F4FF" align="center" colspan="2" align="center" height="28">
<input class=button1 type="submit" value=" 修 改" name="action" style=" font-size: 10pt; height: 26; width:50">
<input class=button1 type="reset" value=" 取 消 " name="reset" style=" font-size: 10pt; height: 26; width:50"></td>
</tr>
</form>
</TABLE>
<p align=center> <b><a href="person.asp">返回个人信息首页</a></b></p>
</BODY></HTML>