日期:2014-05-17  浏览次数:20845 次

会员系统用户登陆不上去,总是提示密码错误,请高手帮我检查一下我的代码,看看问题出在哪里?谢谢
一.登陆页面
<form   method= "POST "   action= "login.asp ">
    <p> 用户名 <input   type= "text "   name= "UserName "   size= "20 "> </p>
    <p> 密码&nbsp;   <input   type= "password "   name= "Password "   size= "20 "> </p>
    <p> <input   type= "submit "   value= "提交 "   name= "B1 "> <input   type= "reset "   value= "复原 "   name= "B2 "> </p>
</form>


二.login.asp页面
<%@   language= "vbscript "   %>
<%
dim   conn,db
dim   connstr
db= "../Databases/0791idc.mdb "   '数据库文件位置
on   error   resume   next
connstr= "DBQ= "+server.mappath( " "&db& " ")+ ";DefaultDir=;DRIVER={Microsoft   Access   Driver   (*.mdb)}; "
set   conn=server.createobject( "ADODB.CONNECTION ")
if   err   then
err.clear
else
conn.open   connstr
end   if
sub   CloseConn()
conn.close
set   conn=nothing
end   sub
%>
<%

name=request( "username ")
pass=request( "password ")

set   rs=conn.execute( "select   *   from   User   where   UserName= ' "   &   name   &   " ' ")
if   rs.eof   then%>
错误,没有这个用户!
<a   href= "login.htm "> 返回 </a>
<%response.end
else
    if   pass=rs( "Password ")   then%>
          登录成功
    <%session( "username ")=namexin
    else
    %> 密码错误
      <a   href= "login.htm "> 返回 </a>
      <%
    end   if
end   if
%>


数据库里面,会员对应的表名叫“User”,注册用户字段名称“UserName”,密码字段名称“Password”

请高手帮我看看,我上面的语句问题出来哪里?


------解决方案--------------------
查收邮箱,解压缩覆盖就可以了。问题真在数据库,你数据库里的都是md5加密后的值,而你的密码没有md5加密,怎么能一样呢,所以密码错误,加分。嘿嘿