I have created a login.asp page which i have posted below. When I login into my site, it automatically takes me to the redirect page "index.html" which means that i entered the wrong login information.
I believe i am not connecting to the access table correctly.
Here are some of the characters I used(hope this helps clear up my asp page)
Email --- this is the title to the login column in my access table
Password --- password column title in my table
email --- this is the "name" for the email input text box
password --- this is the "name" for the password input text box
dsn --- access_registration_db.dsn
Access database --- registration.mdb
tablename --- tblRegister
Any thoughts on where I went wrong? Thanks
Expand|Select|Wrap|Line Numbers
- <%
- Function Login(Email, Password)
- Dim cn
- Dim rs
- Dim strSQL
- Dim strCn
- Set cn = CreateObject("ADODB.Connection")
- Set rs = CreateObject("ADODB.Recordset")
- strSQL = "SELECT * FROM tblRegister WHERE EmailName = '"
- strSQL = strSQL & Email & "'"
- On Error Resume Next
- cn.ConnectionString = "DSN=access_registration_db.dsn" & Application("registration.mdb")
- cn.Open
- If Err Then Exit Function
- rs.Open strSQL, cn
- If Err Then Exit Function
- If rs("password") = Password Then
- Login = True
- Else
- Login = False
- End If
- rs.Close
- cn.Close
- Exit Function
- End Function
- If Login(Request.Form("email"), Request.Form("password")) Then
- Response.REdirect "accountpage.html"
- Else
- Response.Redirect "index.html"
- End If
- %>