Log-in form question

Discussion about any web related scripting languages like JavaScript, ASP, and PHP.
Post Reply
Bluenose
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 3
Joined: Sun Jan 19, 2014 2:18 am

Log-in form question

Post by Bluenose » Sun Apr 20, 2014 11:57 am

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