I have this code here where I am registering users into my website. Everything works fine meaning I can write into the DB but when I test to see if the passwords are the same I get this error:
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/ReclaimAmerica.org/test.asp, line 98
Now I flagged line 98 with ++++++++
---------------------------------------------------------
Any help would be appreciated!
<!-- #INCLUDE FILE="data.asp" -->
<% Response.Buffer = true %>
<%
'-- Check if Submit button pushed, if not ignore the entire script
If Request.Form("btnAdd" = "Submit" Then
'-- Make sure all boxes have data entered into them
If Request.Form("name" <> "" OR Request.Form("password" <> "" OR _
Request.Form("password2" <> "" OR _
Request.Form("email" <> "" OR _
Request.Form("userID" <> "" Then
'-- Make sure the passwords match
If Request.Form("password" = Request.Form("password2" Then
'-- Declare your variables
Dim DataConnection, cmdDC, RecordSet, SQL, strError
Dim strUserName, strPassword, strEmail, strUserID
'-- Get data from the form fields
strUserName = Request.Form("name"
strPassword = Request.Form("password"
strEmail = Request.Form("email"
strUserID = Request.Form("userID"
'-- Create object and open database
Set DataConnection = Server.CreateObject("ADODB.Connection"
DataConnection.Open "DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & DatabasePath & ";"
Set cmdDC = Server.CreateObject("ADODB.Command"
cmdDC.ActiveConnection = DataConnection
'-- default SQL
SQL = "SELECT * FROM UserRegistration"
If Request.Form("name" <> "" Then
SQL = "SELECT * FROM Register WHERE " & _
"Register.userID='" & strUserID & "' AND " & _
"Register.password ='" & strPassword & _
"' OR Register.email ='" & strEmail & "'"
End If
cmdDC.CommandText = SQL
Set RecordSet = Server.CreateObject("ADODB.Recordset"
'-- Cursor Type, Lock Type
'-- ForwardOnly 0 - ReadOnly 1
'-- KeySet 1 - Pessimistic 2
'-- Dynamic 2 - Optimistic 3
'-- Static 3 - BatchOptimistic 4
RecordSet.Open cmdDC, , 0, 2
'-- check to see if the user and password or
' e-mail address have registered before
If Not RecordSet.EOF Then
If RecordSet.fields("email"=strEmail Then
strError = "<FONT FACE='ARIAL' SIZE='2'><B>" & _
"Sorry this email has already been " & _
"registered, please try again" & _
"</B></FONT>"
Else
'Redo page and say that this User name
'and Password are already taken
strError = "<FONT FACE='ARIAL' SIZE='2'><B>" & _
"Sorry this user name and password are " & _
"already taken, please try again" & _
"</B></FONT>"
End If
Else
'-- Add new record to the database
Dim Dconn, sSQL
Set Dconn = Server.CreateObject("ADODB.Connection"
Dconn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & _
DatabasePath & ";"
sSQL = "INSERT INTO Register(name, email, userID, " & _
"password, userLevel) VALUES ('" & strUserName & _
"','" & strEmail & "','" & strUserID & _
"','" & strPassword & "',1)"
Dconn.Execute sSQL
Dconn.Close
Set Dconn = Nothing
'Forward the user to page to notify of authentication
Response.Redirect "thankyou.asp"
End If
Else
strError = "Your passwords don't match"
End If
'-- Close all connections
+++++++++ RecordSet.Close
Set RecordSet = Nothing
DataConnection.Close
Set DataConnection = Nothing
Else
'Tell them what they entered wrong
strError = "Please fill in all the boxes"
End If
End If
%>
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/ReclaimAmerica.org/test.asp, line 98
Now I flagged line 98 with ++++++++
---------------------------------------------------------
Any help would be appreciated!
<!-- #INCLUDE FILE="data.asp" -->
<% Response.Buffer = true %>
<%
'-- Check if Submit button pushed, if not ignore the entire script
If Request.Form("btnAdd" = "Submit" Then
'-- Make sure all boxes have data entered into them
If Request.Form("name" <> "" OR Request.Form("password" <> "" OR _
Request.Form("password2" <> "" OR _
Request.Form("email" <> "" OR _
Request.Form("userID" <> "" Then
'-- Make sure the passwords match
If Request.Form("password" = Request.Form("password2" Then
'-- Declare your variables
Dim DataConnection, cmdDC, RecordSet, SQL, strError
Dim strUserName, strPassword, strEmail, strUserID
'-- Get data from the form fields
strUserName = Request.Form("name"
strPassword = Request.Form("password"
strEmail = Request.Form("email"
strUserID = Request.Form("userID"
'-- Create object and open database
Set DataConnection = Server.CreateObject("ADODB.Connection"
DataConnection.Open "DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & DatabasePath & ";"
Set cmdDC = Server.CreateObject("ADODB.Command"
cmdDC.ActiveConnection = DataConnection
'-- default SQL
SQL = "SELECT * FROM UserRegistration"
If Request.Form("name" <> "" Then
SQL = "SELECT * FROM Register WHERE " & _
"Register.userID='" & strUserID & "' AND " & _
"Register.password ='" & strPassword & _
"' OR Register.email ='" & strEmail & "'"
End If
cmdDC.CommandText = SQL
Set RecordSet = Server.CreateObject("ADODB.Recordset"
'-- Cursor Type, Lock Type
'-- ForwardOnly 0 - ReadOnly 1
'-- KeySet 1 - Pessimistic 2
'-- Dynamic 2 - Optimistic 3
'-- Static 3 - BatchOptimistic 4
RecordSet.Open cmdDC, , 0, 2
'-- check to see if the user and password or
' e-mail address have registered before
If Not RecordSet.EOF Then
If RecordSet.fields("email"=strEmail Then
strError = "<FONT FACE='ARIAL' SIZE='2'><B>" & _
"Sorry this email has already been " & _
"registered, please try again" & _
"</B></FONT>"
Else
'Redo page and say that this User name
'and Password are already taken
strError = "<FONT FACE='ARIAL' SIZE='2'><B>" & _
"Sorry this user name and password are " & _
"already taken, please try again" & _
"</B></FONT>"
End If
Else
'-- Add new record to the database
Dim Dconn, sSQL
Set Dconn = Server.CreateObject("ADODB.Connection"
Dconn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & _
DatabasePath & ";"
sSQL = "INSERT INTO Register(name, email, userID, " & _
"password, userLevel) VALUES ('" & strUserName & _
"','" & strEmail & "','" & strUserID & _
"','" & strPassword & "',1)"
Dconn.Execute sSQL
Dconn.Close
Set Dconn = Nothing
'Forward the user to page to notify of authentication
Response.Redirect "thankyou.asp"
End If
Else
strError = "Your passwords don't match"
End If
'-- Close all connections
+++++++++ RecordSet.Close
Set RecordSet = Nothing
DataConnection.Close
Set DataConnection = Nothing
Else
'Tell them what they entered wrong
strError = "Please fill in all the boxes"
End If
End If
%>