[求助]asp中身份验证问题
代码如下:
<%
dim nam1, pwd1
nam1=request( "nam ")
pwd1=request( "pwd ")
if nam1= " "or pwd1= " "then
showmessage "用户名和密码不能为空 "
set conn=nothing
end if
set conn = server.Createobject( "ADODB.Connection ")
conn.open "DSN=aa;UID=sa;PWD=123 "
set rs = server.createobject( "ADODB.recordset ")
sql= "select pwd from db2 where nam= ' "& nam1 & " ' "
rs.open sql,conn,0,1
if rs.eof and rs.bof then
showmessage "用户名不存在 "
rs.close
set rs=nothing
set conn=nothing
response.end
end if
if pwd1 <> rs( "pwd ") then
showmessage "密码不正确 "
rs.close
set rs=nothing
set conn=nothing
response.end
end if
response.write " <center> 欢迎进入 </center> "
%>
<%sub showmessage(msg)%>
<center>
<h4> <%=msg%>
</center>
<form>
<p align= "center ">
<input type=button value= "返回重新填写 "onclick= "history.back(); ">
</p>
</form>
<%
response.end
End sub
%>
运行后总是显示 "密码不正确 ",但是我能确我在其它页面输入的密码是正确的而
且数据的传送也没问题,请帮忙看下是不是我的代码错了!谢谢
------解决方案--------------------你的密码有没有加密了?
------解决方案--------------------pwd1=trim(request( "pwd ")),看看
------解决方案--------------------你验证也错了,根本没有去验证数据库里的密码,代码错了,去找个简单点了把