Hi,
I got some code for putting a password on a web page from the FAQ section (thanks!) but I keep getting an error on line 12 of the code. Can any of you see where it's going wrong? Could it be becasue the rest of my pages aren't connected with the ado prefix? I've put my code below:
This is the form on the front page:
<Form method=post action=logindone.asp>
Username:
<input type="text" name="username">
<br>
Password:
<input type="password" name="password">
<br>
<br>
<input type="submit" value="Login">
</form>
This is the code it links to (line 12 is adoRS.Open SQL,adoConn) :
*logindone.asp*
<%
Username = Request.Form("USERNAME")
Password = Request.Form("PASSWORD")
'Get username and password from previous page
SQL = "SELECT * FROM Users Where Username='" & Username & "'"
set adoConn = Server.CreateObject ("ADODB.Connection")
set adoRS = Server.CreateObject ("ADODB.RecordSet")
dbPath = Server.MapPath("FinalProject.mdb")
adoConn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath
adoRS.Open SQL,adoConn
' OPen a DSN less connection to an access database and get the username and password for the record where username=username
If adoRS.EOF Then
'The username doesn't exist, do an error.
Response.Write "Username Doesn't Exist!"
Else
If Trim(Password) = Trim(adoRS("Password")) Then
'If the passwords match
Session("LoggedIn")="TRUE"
'Set a session variable to true
%>
<SCRIPT LANGUAGE=VBSCRIPT>
window.navigate "staffhome.html"
</SCRIPT>
<%
'Forward user to next page
Else
'Passwords don't match
Response.Write "Password is incorrect"
End If
End IF
set adoRS = Nothing
set adoConn = Nothing
%>
Thanks in advance...
Lx
I got some code for putting a password on a web page from the FAQ section (thanks!) but I keep getting an error on line 12 of the code. Can any of you see where it's going wrong? Could it be becasue the rest of my pages aren't connected with the ado prefix? I've put my code below:
This is the form on the front page:
<Form method=post action=logindone.asp>
Username:
<input type="text" name="username">
<br>
Password:
<input type="password" name="password">
<br>
<br>
<input type="submit" value="Login">
</form>
This is the code it links to (line 12 is adoRS.Open SQL,adoConn) :
*logindone.asp*
<%
Username = Request.Form("USERNAME")
Password = Request.Form("PASSWORD")
'Get username and password from previous page
SQL = "SELECT * FROM Users Where Username='" & Username & "'"
set adoConn = Server.CreateObject ("ADODB.Connection")
set adoRS = Server.CreateObject ("ADODB.RecordSet")
dbPath = Server.MapPath("FinalProject.mdb")
adoConn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath
adoRS.Open SQL,adoConn
' OPen a DSN less connection to an access database and get the username and password for the record where username=username
If adoRS.EOF Then
'The username doesn't exist, do an error.
Response.Write "Username Doesn't Exist!"
Else
If Trim(Password) = Trim(adoRS("Password")) Then
'If the passwords match
Session("LoggedIn")="TRUE"
'Set a session variable to true
%>
<SCRIPT LANGUAGE=VBSCRIPT>
window.navigate "staffhome.html"
</SCRIPT>
<%
'Forward user to next page
Else
'Passwords don't match
Response.Write "Password is incorrect"
End If
End IF
set adoRS = Nothing
set adoConn = Nothing
%>
Thanks in advance...
Lx