Registration Page Not 100%

Results 1 to 3 of 3

Thread: Registration Page Not 100%

  1. #1
    Machine Guest

    Default Registration Page Not 100%

    Thank You -<BR><BR>I&#039m trying to "trouble shoot" my registration page.<BR><BR>If I enter all information, correctly, completely, no duplicates, the page/form works as expected.<BR>When I intentially "misconfirm" my password selection I get the following error:<BR><BR>Microsoft VBScript runtime error &#039 800a01a8&#039 <BR><BR>Object required: &#039&#039 <BR><BR>/Registration/TourProReg.asp, line 123<BR><BR>Line 123 is : RecordSet.Close<BR><BR>Also, if I type a password and/or username, that already exists in the database, I get the "lengthy" explanation error regarding duplicate entries. The below code also provides for this potential error and should be redoing the page and giving a brief text line telling the user what happend and to try again.<BR><BR>---complete code below---<BR><BR>&#060;% Response.Buffer = true %&#062;<BR><BR>&#060;%<BR>&#039-- Check if Submit button pushed, if not ignore the entire script<BR>If Request.Form("btnAdd") = "Submit" Then<BR><BR>&#039-- Make sure all boxes have data entered into them<BR>If Request.Form("firstname") &#060;&#062; "" OR _<BR>Request.Form("lastname") &#060;&#062; "" OR _<BR>Request.Form("password") &#060;&#062; "" OR Request.Form("password2") &#060;&#062; "" OR _<BR>Request.Form("Email") &#060;&#062; "" OR Request.Form("userID") &#060;&#062; "" Then<BR><BR>&#039-- Make sure the passwords match<BR>If Request.Form("password") = Request.Form("password2") Then<BR><BR>&#039-- Declare your variables<BR>Dim DataConnection, cmdDC, RecordSet, SQL, strError<BR>Dim strFirstName, strLastName, strPassword, strEmail, strUserID<BR><BR>&#039-- Get data from the form fields<BR>strFirstName = Request.Form("firstname")<BR>strLastName = Request.Form("lastname")<BR>strPassword = Request.Form("password")<BR>strEmail = Request.Form("email")<BR>strUserID = Request.Form("userID")<BR><BR>&#039-- Create object and open database<BR>Set DataConnection = Server.CreateObject("ADODB.Connection")<BR>DataCon nection.Open Application("TourPros_ConnectionString")<BR><BR>Se t cmdDC = Server.CreateObject("ADODB.Command")<BR>cmdDC.Acti veConnection = DataConnection<BR><BR><BR>&#039-- default SQL<BR>SQL = "SELECT * FROM Contacts"<BR><BR>If Request.Form("firstname") &#060;&#062; "" Then <BR><BR>SQL = "SELECT Contacts.* FROM Contacts WHERE " &_<BR>"Contacts.userID=&#039" & strUserID & "&#039 AND " &_<BR>"Contacts.password =&#039" & strPassword & _<BR>"&#039 OR Contacts.email =&#039" & strEmail & "&#039"<BR><BR>End If<BR><BR>cmdDC.CommandText = SQL<BR>Set RecordSet = Server.CreateObject("ADODB.Recordset")<BR><BR>&#03 9-- Cursor Type, Lock Type<BR><BR>&#039-- ForwardOnly 0 - ReadOnly 1<BR>&#039-- KeySet 1 - Pessimistic 2<BR>&#039-- Dynamic 2 - Optimistic 3<BR>&#039-- Static 3 - BatchOptimistic 4<BR><BR><BR>RecordSet.Open cmdDC, , 0, 2<BR><BR>&#039-- check to see if the user and password or e-mail address have registered before<BR>If Not RecordSet.EOF Then <BR>If RecordSet.fields("email")=strEmail Then<BR>strError = "&#060;FONT FACE=&#039ARIAL&#039 SIZE=&#039 2&#039&#062;&#060;B&#062;Sorry this email has already been registred, please try again&#060;/B&#062;&#060;/FONT&#062;"<BR><BR>Else<BR><BR>&#039Redo page and say &#039this User name and Password are already taken<BR>strError = "&#060;FONT FACE=&#039ARIAL&#039 SIZE=&#039 2&#039&#062;&#060;B&#062;Sorry this user name and password are already taken, please try again&#060;/B&#062;&#060;/FONT&#062;"<BR><BR>End If<BR><BR>Else<BR><BR>&#039-- Add new record to the database<BR>RecordSet.AddNew<BR>RecordSet("firstna me") = strFirstName <BR>RecordSet("lastname") = strLastName<BR>RecordSet("email") = strEmail<BR>RecordSet("userID") = strUserID<BR>RecordSet("password") = strPassword<BR>RecordSet.Update<BR><BR><BR><BR>Dim MyBody<BR>Dim MyCDONTSMail<BR>strWho = Request("firstname")<BR>strTo = Request("email")<BR>strUserid = Request("userid")<BR>strPassword = Request("password")<BR>Set MyCDONTSMail = CreateObject("CDONTS.NewMail")<BR>MyCDONTSMail.Fro m= "machine@thinkfast.net"<BR>MyCDONTSMail.To= strTo<BR>MyCDONTSMail.Subject= "Welcome to ThinkFast.Net"<BR>MyBody = MyBody & "Hello " & strWho & "," & vbCrLf & vbCrLf<BR>MyBody = MyBody & "I would like to thank you for registering with ThinkFast.Net" & vbCrLf & vbCrLf<BR>MyBody = MyBody & "Your username is: " & strUserid & " " & vbCrLf <BR>MyBody = MyBody & "Your password is: " & strPassword & " " & vbCrLf & vbCrLf<BR>MyBody = MyBody & "Please remember to print this email," & vbCrLf<BR>MyBody = MyBody & "so that you have a record of your username and password." & vbCrLf & vbCrLf<BR>MyBody = MyBody & "Make www.ThinkFast.Net a regular visit when you are" & vbCrLf<BR>MyBody = MyBody & "surfing the internet. We hope you enjoy. " & vbCrLf & vbCrLf<BR>MyBody = MyBody & "Once again, thank you and be safe out there," & vbCrLf & vbCrLf<BR>MyBody = MyBody & "MACHINE" & vbCrLf<BR>MyBody = MyBody & "www.thinkfast.net" & vbCrLf<BR>MyCDONTSMail.Body= MyBody<BR>MyCDONTSMail.Send<BR>set MyCDONTSMail=nothing<BR><BR><BR>&#039Forward the user to page to notify of authentication<BR>Response.Redirect "RegComplete.asp"<BR><BR>End If<BR><BR>Else<BR><BR>strError = "Your passwords don&#039t match"<BR><BR>End If<BR><BR>&#039-- Close RecordSet<BR>RecordSet.Close &#039--- Line 123<BR>Set RecordSet = Nothing<BR><BR>Else<BR><BR>&#039Tell them what they entered wrong<BR>strError = "Please fill in all the boxes"<BR><BR>End If<BR><BR>End If<BR><BR>%&#062;<BR>&#060;!-- HTML FORM --&#062;<BR><BR>&#060;%<BR>&#039-- Error message if there is any <BR>Response.write (strError & "<BR>")<BR><BR>%&#062;<BR><BR>&#060;form method="POST" action="TourProReg.asp"&#062;<BR><BR>&#060;head&#0 62;<BR>&#060;/head&#062;<BR><BR>&#060;!--webbot bot="Include" U-Include="../headers/header.htm" TAG="BODY" --&#062;<BR><BR>&#060;h5 align="center"&#062;&#060;font face="Arial"&#062;As a Touring Professional it is important<BR>to have your information available and as up to date as possible. This<BR>will allow potential employers/clients to contact you, &#060;i&#062;fast&#060;/i&#062;, when they<BR>need your services.&#060;/font&#062;&#060;/h5&#062;<BR><BR>&#060;h5 align="center"&#062;&#060;font face="Arial"&#062;After filling out the brief registration<BR>form below, you will be able to navigate to your online resume, enter your<BR>username and password and fill out the details (that you want to fill out) . &#060;/font&#062;&#060;/h5&#062;<BR>&#060;p align="center"&#062; &#060;font face="Arial"&#062; Best of all ... it&#039s easy and free!!&#060;/font&#062;&#060;/p&#062;<BR>&#060;div align="center"&#062;<BR>&#060;center&#062;<BR>&#06 0;table border="0" cellpadding="3" cellspacing="0" width="65%"&#062;<BR>&#060;tr&#062;<BR>&#060;td width="50%" align="right" bgcolor="#000000"&#062;&#060;font face="Arial" size="2" color="#FF0000"&#062;&#060;b&#062;First Name:&#060;/b&#062;&#060;/font&#062;&#060;/td&#062;<BR>&#060;td width="50%"&#062;&#060;input type="text" name="firstname" size="20"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td width="50%" align="right" bgcolor="#000000"&#062;&#060;font face="Arial" size="2" color="#FF0000"&#062;&#060;b&#062;Last Name:&#060;/b&#062;&#060;/font&#062;&#060;/td&#062;<BR>&#060;td width="50%"&#062;&#060;input type="text" name="lastname" size="20"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td width="50%" align="right" valign="bottom" bgcolor="#000000"&#062;&#060;font face="Arial" size="2" color="#FF0000"&#062;&#060;b&#062;Email:&#060;/b&#062;&#060;/font&#062;&#060;/td&#062;<BR>&#060;td width="50%"&#062;<BR>&#060;p style="line-height: 100%; margin-top: 0; margin-bottom: 0"&#062;&#060;font size="1" face="Arial"&#062;(make<BR>sure this is accurate)&#060;/font&#062;&#060;/p&#062;<BR>&#060;p style="line-height: 100%; margin-top: 0; margin-bottom: 0"&#062;&#060;input type="text" name="email" size="20"&#062;&#060;/p&#062;<BR>&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td width="50%" align="right" bgcolor="#000000"&#062;&#060;font face="Arial" size="2" color="#FF0000"&#062;&#060;b&#062;Choose<BR>a UserID:&#060;/b&#062;&#060;/font&#062;&#060;/td&#062;<BR>&#060;td width="50%"&#062;&#060;input type="text" name="userID" size="20"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td width="50%" align="right" bgcolor="#000000"&#062;&#060;font face="Arial" size="2" color="#FF0000"&#062;&#060;b&#062;Choose<BR>a Password:&#060;/b&#062;&#060;/font&#062;&#060;/td&#062;<BR>&#060;td width="50%"&#062;&#060;input type="password" name="password" size="20"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td width="50%" align="right" bgcolor="#000000"&#062;&#060;font face="Arial" size="2" color="#FF0000"&#062;&#060;b&#062;Confirm<BR>Passw ord:&#060;/b&#062;&#060;/font&#062;&#060;/td&#062;<BR>&#060;td width="50%"&#062;&#060;input type="password" name="password2" size="20"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;/table&#062;<BR>&#060;/center&#062;<BR>&#060;/div&#062;<BR>&#060;p align="center"&#062;&#060;input type="submit" value="Submit" name="btnAdd"&#062;&#060;input type="reset" value="Reset" name="B2"&#062;&#060;/p&#062;<BR>&#060;/form&#062;<BR><BR>&#060;hr&#062;<BR>&#060;!--webbot bot="Include" U-Include="../Footer/footer.htm" TAG="BODY" --&#062;

  2. #2
    Join Date
    Dec 1969
    Posts
    277

    Default RE: Registration Page Not 100%

    To make sure all boxes have data entered into them you need to use AND instead of OR. You should assign values to your variables and use them to verify the conditions instead of calling the request object multiple times.... Review you code again.<BR>

  3. #3
    Machine Guest

    Default RE: Registration Page Not 100%

    Hi JJ and Thank You for your time,<BR><BR>I believe that I did what you suggested (see code below). However, now, when I simply enter a name into one field (first name) I get the following error:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80004005&#039 <BR><BR>[Microsoft][ODBC Microsoft Access Driver] Field &#039Contacts.UserID&#039 cannot be a zero-length string. <BR><BR>/Registration/TourProReg.asp, line 81<BR><BR>Now, I have intentially set the data base to not accept a "zero-length" string (right? / wrong?), for this filed. But, shouldn&#039t the ASP code "catch" the empty field prior to the code attempting to write to the database? BTW - Contacts.UserID is the Table.FieldName for the "Username" form field.<BR><BR>---adjusted code below---<BR><BR>&#060;% Response.Buffer = true %&#062;<BR><BR>&#060;%<BR>&#039-- Check if Submit button pushed, if not ignore the entire script<BR>If Request.Form("btnAdd") = "Submit" Then<BR><BR>&#039-- Declare your variables<BR>Dim DataConnection, cmdDC, RecordSet, SQL, strError<BR>Dim strFirstName, strLastName, strPassword, strPassword2, strEmail, strUserID<BR><BR>&#039-- Get data from the form fields<BR>strFirstName = Request.Form("firstname")<BR>strLastName = Request.Form("lastname")<BR>strPassword = Request.Form("password")<BR>strPassword2 = Request.Form("password2")<BR>strEmail = Request.Form("email")<BR>strUserID = Request.Form("userID")<BR><BR>&#039-- Make sure all boxes have data entered into them<BR>If strFirstName &#060;&#062; "" AND _<BR>strLastName &#060;&#062; "" AND _<BR>strPassword &#060;&#062; "" AND strPassword2 &#060;&#062; "" AND _<BR>strEmail &#060;&#062; "" AND strUserID &#060;&#062; "" Then<BR><BR>&#039-- Make sure the passwords match<BR>If Request.Form("password") = Request.Form("password2") Then<BR><BR><BR>&#039-- Create object and open database<BR>Set DataConnection = Server.CreateObject("ADODB.Connection")<BR>DataCon nection.Open Application("TourPros_ConnectionString")<BR> <BR>Set cmdDC = Server.CreateObject("ADODB.Command")<BR>cmdDC.Acti veConnection = DataConnection<BR><BR><BR>&#039-- default SQL<BR>SQL = "SELECT * FROM Contacts"<BR><BR>If Request.Form("firstname") &#060;&#062; "" Then <BR><BR> SQL = "SELECT Contacts.* FROM Contacts WHERE " &_<BR> "Contacts.userID=&#039" & strUserID & "&#039 AND " &_<BR> "Contacts.password =&#039" & strPassword & _<BR> "&#039 OR Contacts.email =&#039" & strEmail & "&#039"<BR> <BR>End If<BR><BR>cmdDC.CommandText = SQL<BR>Set RecordSet = Server.CreateObject("ADODB.Recordset")<BR><BR>&#03 9-- Cursor Type, Lock Type<BR><BR>&#039-- ForwardOnly 0 - ReadOnly 1<BR>&#039-- KeySet 1 - Pessimistic 2<BR>&#039-- Dynamic 2 - Optimistic 3<BR>&#039-- Static 3 - BatchOptimistic 4<BR><BR><BR>RecordSet.Open cmdDC, , 0, 2<BR><BR>&#039-- check to see if the user and password or e-mail address have registered before<BR>If Not RecordSet.EOF Then <BR> If RecordSet.fields("email")=strEmail Then<BR> strError = "&#060;FONT FACE=&#039ARIAL&#039 SIZE=&#039 2&#039&#062;&#060;B&#062;Sorry this email has already been registred, please try again&#060;/B&#062;&#060;/FONT&#062;"<BR> <BR> Else<BR> <BR> &#039Redo page and say &#039this User name and Password are already taken<BR> strError = "&#060;FONT FACE=&#039ARIAL&#039 SIZE=&#039 2&#039&#062;&#060;B&#062;Sorry this user name and password are already taken, please try again&#060;/B&#062;&#060;/FONT&#062;"<BR> <BR> End If<BR><BR>Else<BR><BR> &#039-- Add new record to the database<BR> RecordSet.AddNew<BR> RecordSet("firstname") = strFirstName <BR> RecordSet("lastname") = strLastName<BR> RecordSet("email") = strEmail<BR> RecordSet("userID") = strUserID<BR> RecordSet("password") = strPassword<BR> RecordSet.Update<BR> <BR> <BR> <BR>Dim MyBody<BR>Dim MyCDONTSMail<BR> strWho = Request("firstname")<BR> strTo = Request("email")<BR> strUserid = Request("userid")<BR> strPassword = Request("password")<BR> Set MyCDONTSMail = CreateObject("CDONTS.NewMail")<BR> MyCDONTSMail.From= "machine@thinkfast.net"<BR> MyCDONTSMail.To= strTo<BR> MyCDONTSMail.Subject= "Welcome to ThinkFast.Net"<BR> MyBody = MyBody & "Hello " & strWho & "," & vbCrLf & vbCrLf<BR> MyBody = MyBody & "I would like to thank you for registering with ThinkFast.Net" & vbCrLf & vbCrLf<BR> MyBody = MyBody & "Your username is: " & strUserid & " " & vbCrLf <BR> MyBody = MyBody & "Your password is: " & strPassword & " " & vbCrLf & vbCrLf<BR> MyBody = MyBody & "Please remember to print this email," & vbCrLf<BR> MyBody = MyBody & "so that you have a record of your username and password." & vbCrLf & vbCrLf<BR> MyBody = MyBody & "Make www.ThinkFast.Net a regular visit when you are" & vbCrLf<BR> MyBody = MyBody & "surfing the internet. We hope you enjoy. " & vbCrLf & vbCrLf<BR> MyBody = MyBody & "Once again, thank you and be safe out there," & vbCrLf & vbCrLf<BR> MyBody = MyBody & "MACHINE" & vbCrLf<BR> MyBody = MyBody & "www.thinkfast.net" & vbCrLf<BR> MyCDONTSMail.Body= MyBody<BR> MyCDONTSMail.Send<BR> set MyCDONTSMail=nothing<BR><BR> <BR> &#039Forward the user to page to notify of authentication<BR> Response.Redirect "RegComplete.asp"<BR><BR>End If<BR><BR>Else<BR><BR> strError = "Your passwords don&#039t match"<BR> <BR>End If<BR><BR> &#039-- Close RecordSet<BR> RecordSet.Close<BR> Set RecordSet = Nothing<BR><BR>Else<BR><BR> &#039Tell them what they entered wrong<BR> strError = "Please fill in all the boxes"<BR> <BR>End If<BR><BR>End If<BR><BR>%&#062;<BR>&#060;!-- HTML FORM --&#062;<BR><BR>&#060;%<BR> &#039-- Error message if there is any <BR> Response.write (strError & "<BR>")<BR> <BR>%&#062;<BR><BR>&#060;form method="POST" action="TourProReg.asp"&#062;<BR><BR>&#060;head&#0 62;<BR>&#060;/head&#062;<BR><BR>&#060;!--webbot bot="Include" U-Include="../headers/header.htm" TAG="BODY" --&#062;<BR><BR>&#060;h5 align="center"&#062;&#060;font face="Arial"&#062;As a Touring Professional it is important<BR>to have your information available and as up to date as possible.&nbsp; This<BR>will allow potential employers/clients to contact you, &#060;i&#062;fast&#060;/i&#062;, when they<BR>need your services.&#060;/font&#062;&#060;/h5&#062;<BR><BR>&#060;h5 align="center"&#062;&#060;font face="Arial"&#062;After filling out the brief registration<BR>form below, you will be able to navigate to your online resume, enter your<BR>username and password and fill out the details (that you want to fill out)&nbsp;.&nbsp;&#060;/font&#062;&#060;/h5&#062;<BR>&#060;p align="center"&#062; &#060;font face="Arial"&#062; Best of all ... it&#039s easy and free!!&#060;/font&#062;&#060;/p&#062;<BR> &#060;div align="center"&#062;<BR> &#060;center&#062;<BR> &#060;table border="0" cellpadding="3" cellspacing="0" width="65%"&#062;<BR> &#060;tr&#062;<BR> &#060;td width="50%" align="right" bgcolor="#000000"&#062;&#060;font face="Arial" size="2" color="#FF0000"&#062;&#060;b&#062;First Name:&#060;/b&#062;&#060;/font&#062;&#060;/td&#062;<BR> &#060;td width="50%"&#062;&#060;input type="text" name="firstname" size="20"&#062;&#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062;<BR> &#060;td width="50%" align="right" bgcolor="#000000"&#062;&#060;font face="Arial" size="2" color="#FF0000"&#062;&#060;b&#062;Last Name:&#060;/b&#062;&#060;/font&#062;&#060;/td&#062;<BR> &#060;td width="50%"&#062;&#060;input type="text" name="lastname" size="20"&#062;&#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062;<BR> &#060;td width="50%" align="right" valign="bottom" bgcolor="#000000"&#062;&#060;font face="Arial" size="2" color="#FF0000"&#062;&#060;b&#062;Email:&#060;/b&#062;&#060;/font&#062;&#060;/td&#062;<BR> &#060;td width="50%"&#062;<BR> &#060;p style="line-height: 100%; margin-top: 0; margin-bottom: 0"&#062;&#060;font size="1" face="Arial"&#062;(make<BR> sure this is accurate)&#060;/font&#062;&#060;/p&#062;<BR> &#060;p style="line-height: 100%; margin-top: 0; margin-bottom: 0"&#062;&#060;input type="text" name="email" size="20"&#062;&#060;/p&#062;<BR> &#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062;<BR> &#060;td width="50%" align="right" bgcolor="#000000"&#062;&#060;font face="Arial" size="2" color="#FF0000"&#062;&#060;b&#062;Choose<BR> a UserID:&#060;/b&#062;&#060;/font&#062;&#060;/td&#062;<BR> &#060;td width="50%"&#062;&#060;input type="text" name="userID" size="20"&#062;&#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062;<BR> &#060;td width="50%" align="right" bgcolor="#000000"&#062;&#060;font face="Arial" size="2" color="#FF0000"&#062;&#060;b&#062;Choose<BR> a Password:&#060;/b&#062;&#060;/font&#062;&#060;/td&#062;<BR> &#060;td width="50%"&#062;&#060;input type="password" name="password" size="20"&#062;&#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062;<BR> &#060;td width="50%" align="right" bgcolor="#000000"&#062;&#060;font face="Arial" size="2" color="#FF0000"&#062;&#060;b&#062;Confirm<BR> Password:&#060;/b&#062;&#060;/font&#062;&#060;/td&#062;<BR> &#060;td width="50%"&#062;&#060;input type="password" name="password2" size="20"&#062;&#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;/table&#062;<BR> &#060;/center&#062;<BR> &#060;/div&#062;<BR> &#060;p align="center"&#062;&#060;input type="submit" value="Submit" name="btnAdd"&#062;&#060;input type="reset" value="Reset" name="B2"&#062;&#060;/p&#062;<BR> &#060;/form&#062;<BR><BR>&#060;hr&#062;<BR>&#060;!--webbot bot="Include" U-Include="../Footer/footer.htm" TAG="BODY" --&#062;<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •