修改密码中的问题,请大侠相助!谢谢~~~~~~~~~~~~~~

zigine 2003-12-12 11:51:09
我现在要在这段时判断,用户输入的旧密是否正确要怎么判断?
相关字段:pwd存放密码字段
相关表单:password为旧密码 pwd为新输入的密码。

在这里要怎么判断,输入表单里的是否跟数据库里的pwd字段的值一样。然后,通过修密码。

<%
if request("modiffy")="yes" then
sql="update users set pwd='"&request("pwd1")&"' where id="&session("id")
conn.execute(sql)
response.Write(sql)
response.End()
response.write "<script language=javascript>alert('更改成功!');location.href='/index.asp';</script>"

%>

...全文
37 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
a_zhe_20 2003-12-13
  • 打赏
  • 举报
回复
提示的结果是什么?
就是
response.write "数据库密码:"&rs("pwd")
response.write "当前密码:"&request("password")
的结果
zigine 2003-12-13
  • 打赏
  • 举报
回复
也不行,大哥,现在要怎么测试,那里错了》?
zigine 2003-12-13
  • 打赏
  • 举报
回复
没有加密,我再试试看
a_zhe_20 2003-12-13
  • 打赏
  • 举报
回复
你数据库里存储的密码是否加密过了?

if not rs.eof then
response.write "数据库密码:"&rs("pwd")
response.write "当前密码:"&request("password")
if rs("pwd")<>request("password") then
response.write "旧密码输入错误!"
response.end
end if
zigine 2003-12-13
  • 打赏
  • 举报
回复
有取过来呀,你看
<%
if request("modiffy")="yes" then
'查询旧密码
'password=request("password")
'response.Write(password)
'response.End()
sql="select pwd from users where id="&session("id")
rs.open sql,conn,1,1
if not rs.eof then
if rs("pwd")<>request("password") then
response.write "旧密码输入错误!"
response.end
end if
end if
sql="update users set pwd='"&request("pwd1")&"' where id="&session("id")
conn.execute(sql)
response.Write(sql)
response.End()
response.write "<script language=javascript>alert('更改成功!');location.href='/index.asp';</script>"

%>

<%
conn.close
set conn=nothing
response.End
else
sql="select * from users where id="&session("id")

set rs=conn.execute(sql)


'response.Write(sql)
'response.End()
%>
<SCRIPT language=javascript>

function checkvalue()
{

if (CutSpace(ff.password.value)=="")
{
alert("请填写密码!");
ff.password.focus();
return false;
}
if (ff.pwd1.value.length<6 || ff.pwd1.value.length>16)
{
alert("密码字符数不符合要求");
ff.pwd1.focus();
return false;
}
if (CutSpace(ff.pwd1.value)!=CutSpace(ff.pwd2.value))
{
alert("两次填写的密码不符!");
ff.pwd2.focus();
return false;
}
}

</SCRIPT>
<TABLE style="BORDER-RIGHT: #acacad 1px solid; BORDER-LEFT: #acacad 1px solid"
height=2 cellSpacing=0 cellPadding=0 width=775 align=center bgColor=#cccccc
border=0>
<TBODY>
<TR>
<TD></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=775 align=center border=0>
<TBODY>
<TR>
<TD><IMG height=100 src="/user/userimg/banner.gif"
width=775></TD></TR></TBODY></TABLE>
<TABLE height=1 cellSpacing=0 cellPadding=0 width=775 align=center border=0>
<TBODY>
<TR>
<TD></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=775 align=center border=0>
<TBODY>
<TR>
<TD style="BORDER-LEFT: #f4f4f5 1px solid" vAlign=top align=middle width=175
bgColor=#f4f4f4>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD align=middle><IMG height=40 src="/user/userimg/images033.gif"
width=175></TD></TR></TBODY></TABLE>
<TABLE height=1 cellSpacing=0 cellPadding=0 width=173 align=center
bgColor=#bba800 border=0>
<TBODY>
<TR>
<TD></TD></TR></TBODY></TABLE>
<TABLE
style="BORDER-RIGHT: #d6c300 1px solid; BORDER-LEFT: #d6c300 1px solid"
height=207 cellSpacing=0 cellPadding=0 width=173 align=center border=0>
<TBODY>
<TR>
<TD vAlign=top align=middle>
<TABLE cellSpacing=0 cellPadding=0 width=173 border=0>
<TBODY>
<TR>
<TD><BR><IMG height=25 src="/user/userimg/images034.gif"
width=170></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD><IMG height=25 src="/user/userimg/images035-1.gif"
width=170></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD><IMG height=25 src="/user/userimg/images036.gif"
width=170></TD></TR></TBODY></TABLE><BR></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=175 align=center border=0>
<TBODY>
<TR>
<TD><IMG height=8 src="/user/userimg/images02.gif"
width=175></TD></TR></TBODY></TABLE></TD>
<TD vAlign=top align=middle width=10 bgColor=#ffffff>
<TABLE height=200 cellSpacing=0 cellPadding=0 width=10 border=0>
<TBODY>
<TR>
<TD vAlign=top><IMG height=200 src="/user/userimg/images07.gif"
width=10></TD></TR></TBODY></TABLE></TD>
<TD vAlign=top align=middle width=590 bgColor=#ffffff>
<TABLE height=10 cellSpacing=0 cellPadding=0 width=570 border=0>
<TBODY>
<TR>
<TD></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=590 border=0>
<TBODY>
<TR>
<TD><IMG height=30 src="/user/userimg/images037.gif"
width=590></TD></TR></TBODY></TABLE>
<TABLE height=1 cellSpacing=0 cellPadding=0 width=588 align=center
bgColor=#bba800 border=0>
<TBODY>
<TR>
<TD></TD></TR></TBODY></TABLE>
<TABLE
style="BORDER-RIGHT: #d6c300 1px solid; BORDER-LEFT: #d6c300 1px solid"
height=207 cellSpacing=0 cellPadding=0 width=588 align=center border=0>
<TBODY>
<TR>
<TD vAlign=top width=580>
<TABLE cellSpacing=0 cellPadding=0 width=568 align=center
border=0><TBODY>
<TR>
<TD colSpan=3 height=3> </TD></TR>
<TR>
<TD width=3> </TD>
<TD vAlign=top>
<P><BR><BR>  请填写您的详细注册信息,以便我们更好地为您提供服务。您的用户名为<FONT
color=#ff0000><%=session("uname")%></FONT>。<BR>  标有<FONT
color=#ff3333>***</FONT>的项目内容必须填写!<BR></P>
<TABLE cellSpacing=0 cellPadding=0 width=500 align=center
border=0>
<FORM id=ff name=ff onsubmit="return checkvalue()" action="uppwd.asp?modiffy=yes"
method=post>
<TBODY>
<TR>
<TD align=right>请输入旧密码:</TD>
<TD> </TD>
<TD><INPUT class=input02 id=password type=password
maxLength=16 size=12 name=password> <FONT
color=#ff3333> </FONT><FONT
color=#ff3333>***</FONT>(请输入原始的注册密码)</TD></TR>
<TR>
<TD align=right width=120>请输入新密码:</TD>
<TD width=10> </TD>
<TD width=370><INPUT class=input02 id=pwd1
type=password maxLength=16 size=12 name=pwd1>
<FONT color=#ff3333>***</FONT>(6-16字符,可以为英文字母、数字)</TD></TR>
<TR>
<TD align=right>重新输入新密码:</TD>
<TD width=10> </TD>
<TD width=370><FONT color=#ff3333><INPUT class=input02
id=pwd2 type=password maxLength=16 size=12
name=pwd2> ***</FONT>(可以帮您找回忘记的密码)</TD></TR>
<TR>
<TD align=right colSpan=3>
<HR align=center width="100%" color=#cccccc noShade
SIZE=1>
</TD></TR>
<TR>
<TD align=right colSpan=3>
<DIV align=center><FONT color=red></FONT> </DIV></TD></TR>
<TR align=middle>
<TD colSpan=3 height=30><BR><INPUT id=modiffy
type=image height=20 width=38
src="/user/userimg/images120.gif" border=0 name=modiffy>
  <A onclick="window.close();return false;"
href="/user/"><IMG height=20
src="/user/userimg/bt_giveup_b.gif" width=38 border=0></A>
</TD></TR></FORM>

<%end if%>
a_zhe_20 2003-12-13
  • 打赏
  • 举报
回复
你的password没有提取过来吧
把password改为request("password")
zigine 2003-12-13
  • 打赏
  • 举报
回复
response.write "旧密码输入错误!"
但是数据的密码是一样的呀,怎么也说旧密码输入错误!?不懂那又错了,5555
zigine 2003-12-13
  • 打赏
  • 举报
回复
提示的结果是什么?
就是
response.write "数据库密码:"&rs("pwd")
response.write "当前密码:"&request("password")
的结果

只显示当前密码,而不显示,数据库密码!怎么办?
jhwcd 2003-12-13
  • 打赏
  • 举报
回复
你把修改的地方的值显示出来,看看对不对!
zigine 2003-12-12
  • 打赏
  • 举报
回复
谢谢 我试试!
a_zhe_20 2003-12-12
  • 打赏
  • 举报
回复
在修改密码之前先查询
if request("modiffy")="yes" then
'查询旧密码
sql="select pwd from user where id="&session("id")
rs.open sql,conn,1,1
if not rs.eof then
if rs("pwd")<>password then
response.write "旧密码输入错误!"
response.end
end if
end if
....做你的操作

end if

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧