Registration Form

Results 1 to 2 of 2

Thread: Registration Form

  1. #1
    Join Date
    Dec 1969

    Default Registration Form

    I add a script to my site to make new profile for users. But i would like not having twice the same email address in the database. I try to have a (Response.Redirect "Error.html") if the script see the same email address. The problem that i have is like so:<BR>as you can see here the new members were added but incorrectly with no data but i was using the same email address. i want my script to stop using the same email on the registration form.<BR><BR>==============LINKS TO SEE MY SCRIPT============<BR> &#060;----REGISTRATION FORM<BR> &#060;--- CHECK YOUR NEW PROFILE<BR><BR>===============HERE MY CODE THAT ADD ALL THE FIELDS=====================<BR>&#060;%<BR>&#039;Di mension variables<BR>Dim adoCon &#039;Holds the Database Connection Object<BR>Dim AddNewMembres &#039;Holds the recordset for the new record to be added to the database<BR>Dim strSQL &#039;Holds the SQL query for the database<BR>Dim strDataDate<BR>Dim strEmail<BR>Dim blnEmailOK<BR><BR>blnEmailOK = True<BR><BR>&#039;Set the diffrent variables for diffrent database types<BR>If strDatabaseType = "SQLServer" Then<BR>&#039;The GetDate() function is used in SQL Server<BR> strDataDate = "GetDate()"<BR>Else<BR> &#039;The now() function is used in Access<BR> strDataDate = "Now()"<BR>End If<BR><BR>&#039;Create an ADO connection odject<BR>Set adoCon = Server.CreateObject("ADODB.Connection")<BR><BR>&#0 39;Set an active connection to the Connection object using a DSN-less connection<BR>adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../ssl_html/Membres.mdb")<BR><BR>&#039;Set an active connection to the Connection object using DSN connection<BR>&#039;adoCon.Open "DSN=guestbook"<BR><BR>&#039;Create an ADO recordset object<BR>Set AddNewMembres = Server.CreateObject("ADODB.Recordset")<BR><BR>&#03 9;Initialise the strSQL variable with an SQL statement to query the database<BR>strSQL = "SELECT tblMembres.* FROM tblMembres;"<BR><BR>&#039;Set the cursor type we are using so we can navigate through the recordset<BR>AddNewMembres.CursorType = 2<BR><BR>&#039;Set the lock type so that the record is locked by ADO when it is updated<BR>AddNewMembres.LockType = 3<BR><BR>&#039;Open the tblComments table using the SQL query held in the strSQL varaiable<BR>AddNewMembres.Open strSQL, adoCon<BR><BR>&#039;Tell the recordset we are adding a new record to it<BR>AddNewMembres.AddNew<BR><BR>&#039;Check there no other users with the same Username<BR>Do While NOT AddNewMembres.EOF<BR> <BR> &#039;If the Username the user has requested already exsists in the database then set the variable Username OK to false<BR> If LCase(EmailForm) = LCase(AddNewMembres("email")) Then blnEmailOK = False<BR> <BR> &#039;Move to the next record in the record set<BR> AddNewMembres.MoveNext<BR>Loop<BR><BR>&#039;If the Username dose not already exsists then save the users details to the database<BR>If blnEmailOK = True Then<BR><BR>&#039;Add a new record to the recordset<BR>AddNewMembres.Fields("prenom") = Request.Form("PrenomForm")<BR>AddNewMembres.Fields ("nomfamille") = Request.Form("FamilleForm")<BR>AddNewMembres.Field s("ville") = Request.Form("VilleForm")<BR>AddNewMembres.Fields( "age") = Request.Form("AgeForm")<BR>AddNewMembres.Fields("e mail") = Request.Form("EmailForm")<BR>AddNewMembres.Fields( "password") = Request.Form("PasswordForm")<BR>AddNewMembres.Fiel ds("jouprefe") = Request.Form("JouprefeForm")<BR>AddNewMembres.Fiel ds("equiprefe") = Request.Form("EquiprefeForm")<BR>AddNewMembres.Fie lds("icq") = Request.Form("IcqForm")<BR>AddNewMembres.Fields("p ostalcode") = Request.Form("PostalCodeForm")<BR>AddNewMembres.Fi elds("experience") = Request.Form("ExpeForm")<BR>AddNewMembres.Fields(" ConnectionInternet") = Request.Form("ConnecForm")<BR>AddNewMembres.Fields ("PhotoMembreName") = Request.Form("ImageForm")<BR>AddNewMembres.Fields( "EquipePetitLogo") = Request.Form("ImagePetitLogoForm")<BR>AddNewMembre s.Fields("EquipeSaisonBanner") = Request.Form("EquipeSaisonBannerForm")<BR>AddNewMe mbres.Fields("EquipeBigShadowLogo") = Request.Form("ShadowForm")<BR><BR>&#039;Write the updated recordset to the database<BR>AddNewMembres.Update<BR>Else<BR> Response.Redirect "Erreur.html"<BR>End if<BR>&#039;Reset server objects<BR>AddNewMembres.Close<BR><BR>Set AddNewMembres = Nothing<BR>Set adoCon = Nothing<BR><BR>&#039;Redirect to the guestbook.asp page<BR>Response.Redirect "Bravo.asp"<BR>%&#062;<BR>=================END OF CODE==================

  2. #2
    Join Date
    Dec 1969

    Default RE: Registration Form

    All I can add here is, you need to have a validation where you check the new email id on the form again the the existing email ids in the database. This you can easlily do by creating a sql which returns you 0/1 (true/false) depening on whether you have that email id in the DB or not.<BR><BR>If is it an existing email id then don&#039;t post the form, instead show a validation failed error message.<BR><BR>Hope it conveys the idea!

Posting Permissions

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