I have a form that users can fill out.
When the user is done I redirect the user to an edit page where they can log out or edit any changes. All this works well. My validation code sends the users to the input form. and I would like to send the users that already have answered at least one question to the edit page I have been playing with the script below but had not gotten any luck. I would really appreciate any help or pointers
I added the
line but that did not work
When the user is done I redirect the user to an edit page where they can log out or edit any changes. All this works well. My validation code sends the users to the input form. and I would like to send the users that already have answered at least one question to the edit page I have been playing with the script below but had not gotten any luck. I would really appreciate any help or pointers
Code:
<%
'Save the entered username and password
Username = Request.Form("txtUsername")
Password = Request.Form("txtPassword")
'Build connection with database
set conn = server.CreateObject ("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath ("qa.mdb")
set rs = server.CreateObject ("ADODB.Recordset")
'Open record with entered username
rs.Open "SELECT * FROM users where username='"& Username &"'", conn, 1
Response.Cookies("ValidUser") = Validated
'If there is no record with the entered username, close connection
'and go back to login with QueryString
If rs.recordcount = 0 then
rs.close
conn.close
set rs=nothing
set conn=nothing
Response.Redirect("login.asp?login=namefailed")
end if
if session("Username") = rs.("username")
response.redirect("edit")
end if
'If entered password is right, close connection and open mainpage
if rs("password") = Password then
Session("Username") = Username
Response.Redirect("questionstry.asp")
'If entered password is wrong, close connection
'and return to login with QueryString
else
rs.Close
conn.Close
set rs=nothing
set conn=nothing
Response.Redirect("login.asp?login=passfailed")
end if
%>
I added the
Code:
end if
if session("Username") = rs.("username")
response.redirect("edit")
end if