注册 登录
编程论坛 ASP技术论坛

if語句

rgbtdkjcel 发布于 2007-12-14 13:49, 459 次点击
<%
     Dim username,userpassword
       username=Trim(request.Form("text1"))
       userpassword=md5(Trim(request.Form("text2")))
      If (username=rs("name") And userpassword=rs("pwd") And username="admin") Then
          session("admin")="admin"
          response.redirect "manager.asp"
         Else  If (username=rs("name") And userpassword=rs("pwd")) Then
            session("status")="ok"
            response.redirect "main.asp"
            Else
            response.write "<a href="&"index.html"&">返回</a>"
            End If
             End If
            %>

請問。。為什麼我在表單中輸入admin, 且密碼與數據庫中的密碼相等。為何不能轉到manager.asp文件呢?
2 回复
#2
madpbpl2007-12-14 13:55
rs("name") 和rs("pwd") 哪来的,没看到对应的记录集。
#3
hmhz2007-12-14 14:27
If (username=rs("name") And userpassword=rs("pwd")) Then
改成
 If username=rs("name") or userpassword=rs("pwd") Then
1