Log-in form question

For general web development questions that are not specifically related to CSS HTML Validator. This includes (but is not limited to) general HTML, CSS, Accessibility, JavaScript, and SEO questions.
Post Reply
Bluenose
Rank 0 - Newcomer
Posts: 3
Joined: Sun Jan 19, 2014 2:18 am

Log-in form question

Post by Bluenose »

Hello

I have an online login (username/password) form which, even if I log-in with the correct credentials, tells me that I have the wrong username/password.

The form is in a file called 'Dimalogin1.asp'. The form posts to submit1.asp which looks like this:

Code: Select all

<% @LANGUAGE=VBScript %>

<%
  Dim Conn, sql, rs
   If IsObject( Session( "Conn" ) ) Then
      Set Conn = Session( "Conn" )
   Else
      set Conn = server.createobject("adodb.connection")

constr = "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=" & "E:\myDatabase.mdb"

Conn.open constr

      Set Session( "Conn" ) = Conn

   End If
   sql = "SELECT * FROM userlist"
   Set rs = Server.CreateObject( "ADODB.Recordset" )
   rs.Open sql, Conn
   rs.MoveFirst()

   While Not rs.EOF

If Lcase(Request( "id" )) = Lcase(rs( "username" )) AND Request( "Pwd" ) = rs( "password" )    Then 

Session( "loginfailure" ) = False

Session( "login" ) = 1

Session( "final" ) = true

Session( "user" ) = Request( "id" )

Call Response.Redirect( "finalpage1.asp" )

End If

rs.MoveNext()    

Wend

Session( "loginFailure" ) = True  

Session( "login" ) = -1

Call Response.Redirect( "Dimalogin1.asp" )

%>
Does that code look correct, please?

Thanks!

Blue
Post Reply