关于修改密码问题
改一个修改密码的功能,提交后转入这个页面,可总是不行,提示"输入的密码位数不能小于4位或大于16位!",确认后回到这个页.
哪位好心的大哥让我看看问题出在哪儿了....
之前的密码是和帐户一样的就可以进入,Card No为卡号,pws有的是空的,有的又有密码,现在要修改密码后密码存在pws里面.
代码如下:
<%
if not session("passed") then
Response.Redirect "chgpwd.asp"
end if
dim conn
dim connstr
on error resume next
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(vip.mdb)
if err then
err.clear
else
conn.open connstr
end if
'OldPassword=Request("OldPassword")
'NewPassword=Request("NewPassword")
if request(NewPassword)>16 or request(NewPassword)<4 then
response.write "<script language=javascript>alert('输入的密码位数不能小于4位或大于16位!');history.go(-1);</script>"
response.End
end if
set rs=server.createobject("adodb.recordset")
sql="select * from [VIP Customer Master]"
rs.open sql,conn,1,3
'更新管理员密码
if OldPassword<>rs("Card No") or OldPassword<>rs("pws") then
response.write "<script language=javascript>alert('原密码错误,请返回重新输入!');history.go(-1);</script>"
response.End
else
rs("pws")=NewPassword
end if
rs.update
rs.close
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>laws</title>
</head>
<body>
您的新密码为:<%=NewPassword%>
</body>
</html>