偶刚学的,不是很明白。现在是制作修改密码的页面出错啊,麻烦高手帮忙看一下。
<!--#include file="conn.asp" -->
<%
dim newpassword,repassword
newpassword=Trim(Request("repassword"))
repassword=Trim(Request("repassword"))
set rs=server.createobject("adodb.recordset")
sql="select * from reader"
rs.open sql,db,1,1
admin_name=rs("admin_name")
admin_pwd=rs("admin_pwd")
rank=rs("rank")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>修改密码</title>
</head>
<body topmargin="0">
<!--#include file="top.asp"-->
<table width="738" border="1" align="center" cellspacing="0" bordercolor="#F4F5F7">
<form name="form" method="post" action="adminsave.asp">
<tr align="center" valign="middle" bgcolor="#006699">
<td colspan="2">修改密码</td>
</tr>
<tr>
<td align="right" width="40%">帐 名: </td>
<td><input name="admin_name" type="text" id="admin_name" value="<%=admin_name%>" readonly=""></td>
</tr>
<tr>
<td align="right">原密码: </td>
<td><input name="password" type="password" id="password"></td>
</tr>
<tr>
<td align="right">新密码: </td>
<td><input name="newpassword" type="password" id="newpassword"></td>
</tr>
<tr>
<td align="right">重输新密码: </td>
<td><input name="repassword" type="password" id="repassword"></td>
</tr>
<tr>
<td align="right">权 限: </td>
<td><input name="rank" type="text" id="rank" value="<%=rank%>" size="5" readonly>
(1为管理,0为借阅者)</td>
</tr>
<tr>
<td><input name="editadd" type="hidden" id="editadd" value="edit"></td>
</tr>
<tr>
<td align="center" colspan="2"><input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置"></td>
</tr>
</form>
</table>
</body>
</html>
这个是提交的页面
<!--#include file="conn.asp"-->
<%
dim admin_name,admin_pwd,passwor,repassword,rank
admin_name=trim(request("admin_name"))
admin_pwd=trim(request("admin_pwd"))
password=trim(request("password"))
newpassword=trim(request("newpassword"))
repassword=trim(request("repassword"))
rank=trim(request("rank"))
set rs=server.createobject("adodb.recordset")
if id="" then sql="select * from reader where admin_name='"&admin_name&"'"
rs.open sql,db,1,3
if rs("admin_pwd")<>password then
response.write "<script language=javascript>alert('原密码不正确!');history.back(-1)</script>"
if newpassword="" or repassword="" then
response.write "<script language=javascript>alert('新密码不能空');history.back(-1)</script>"
if newpassword<>repassword then
response.write "<script language=javascript>alert('两次密码不一致');history.back(-1)</script>"
else
rs("admin_pwd")=newpassword
rs.update
id=rs("id")
rs.close
set rs=nothing
response.redirect "<script language=javascript>alert('添加成功');history.back(-1)</script>"
end if
end if
end if
%>
没回答,太失望了。
[ 此贴被freeboy在2007-04-28 01:37重新编辑 ]