39 users online (0 members and 39 guests)  


  Results 1 to 8 of 8

Related

  1. Code needed for "Basic Info" alteration    Forum: Myspace Forum
    Replies: 1
  2. Domain name registration ?    Forum: Web Hosting Forum
    Replies: 1
  1. #1
    4mybsa's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2008
    Location
    Northeast Texas
    Posts
    6

    need help with code for registration info to db

    I have build a payment registration page that needs to store to db. The db is complete the form is complete but I keep getting stuck changing my Password proc file to work for the registration page. I will post both the html form and the proc. If someone could help me rewrite this It would help. I have been playing with it for over a month and now I;m stuck because my site goes live in 2 weeks and this is my hold up. Would like to make sure Username input on Payment Registration Form matches Register user in my users table before posting to Registration db if not match return to form if match store data and goto Success.asp Please help!!

    ****Payment Registration form****

    <HTML>
    <HEAD><TITLE>Register</TITLE></HEAD>

    <table border="0" width="888">
    <tr>
    <td style="font-size: 12px;width: 882;margin:0;font-weight: 700;line-height: 14px;color: #666666; font-family: Arial">
    <p align="left">
    </td></tr></table>
    <P align="left">
    <font color="#800000" size="5"><b>Payment Registration</b></font></P>



    <P align="left">
    <b><font size="4">This information is required in order to receive payment for your use of this shopping site.</font></b></P>


    <P align="left">
    <b>Please provide the following contact information: </b>(All of this
    information must be complete before payment can be made.)</P>


    <form id="Adding3" action="addingregproc.asp" method="post">

    <BLOCKQUOTE>
    <div align="left">
    <PRE><EM> <b><font size="3"> First Name </font></b></EM><font size="3"><b><INPUT TYPE=TEXT NAME="Contact_First_Name" SIZE=25>
    </b></font><b><EM><font size="3"> Last Name </font></EM></b><font size="3"><b><INPUT TYPE=TEXT NAME="Contact_Last_Name" SIZE=25>
    </b></font><b><EM><font size="3"> User Name </font></EM></b><font size="3"><b><INPUT TYPE=TEXT NAME="Contact_User_Name" SIZE=25>
    </b></font><b><EM><font size="3"> Street Address </font></EM></b><font size="3"><b><INPUT TYPE=TEXT NAME="Contact_Street_Address" SIZE=35>
    </b></font><b><EM><font size="3"> City </font></EM></b><font size="3"><b><INPUT TYPE=TEXT NAME="Contact_City" SIZE=35>
    </b></font><b><EM><font size="3"> State/Province </font></EM></b><font size="3"><b><INPUT TYPE=TEXT NAME="Contact_State" SIZE=35>
    </b></font><b><EM><font size="3"> Zip/Postal Code </font></EM></b><font size="3"><b><INPUT TYPE=TEXT NAME="Contact_Zip_Code" SIZE=12 MAXLENGTH=12>
    </b></font><b><EM><font size="3"> Country </font></EM></b><font size="3"><b><INPUT TYPE=TEXT NAME="Contact_Country" SIZE=25>
    </b></font><b><EM><font size="3"> Home Phone </font></EM></b><font size="3"><b><INPUT TYPE=TEXT NAME="Contact_Home_Phone" SIZE=25 MAXLENGTH=25>
    </b></font><b><EM><font size="3"> PayPal Acct. </font></EM></b><font size="3"><b><INPUT TYPE=TEXT NAME="Contact_PayPal_Acct" SIZE=25 MAXLENGTH=25>
    </b></font><b><EM><font size="3"> E-mail </font></EM></b><font size="3"><b><INPUT TYPE=TEXT NAME="Contact_Email" SIZE=25></b></font></PRE>
    </div>

    <center>

    <div align="left">
    <PRE><font size="3"><b>How would you like to be paid <u>PayPal</u> or <u>Check</u>? <INPUT TYPE=TEXT NAME="Contact_Payment_Type" SIZE=25></b></font>
    </PRE>
    </div>
    </BLOCKQUOTE>
    <p>
    <INPUT TYPE=submit VALUE="Submit Payment Registration"></p>

    </body>

    </html>

  2. #2
    4mybsa's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2008
    Location
    Northeast Texas
    Posts
    6

    Re: need help with code for registration info to db

    ****Old Proc****
    <%@ Language=VBScript %>
    <% Option Explicit %>
    <!-- #INCLUDE FILE = "adovbs.inc" -->

    <%
    'for an explanation of the above file, see
    Dim Database, myConn, mySQL

    'Connect to the database access.mdb, table is registration

    Database="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("*****/accesscustbaseusers.mdb") & ""

    Set myConn=Server.CreateObject("ADODB.Connection")

    myConn.Open Database

    'checking that something was entered for all fields

    Dim myRS, bolAlreadyExists, strUserName
    If ((Request.Form("Password") = "") OR (Request.Form("EmailAddress") = "") OR (Request.Form("Username") = "")) Then
    Response.Write "<A HREF='addinguser.asp'>"
    Response.Write "You must enter values for all the fields."
    Response.Write "</A>"
    session("myuser")=""
    Response.end
    end if
    %>
    <!-- #INCLUDE FILE = "emailcheck.asp" -->
    <%


    'checking that the username doesn't already exist
    BolAlreadyExists = False
    Set myRS = Server.CreateObject("ADODB.Recordset")
    myRS.Open "users", myConn, , adLockOptimistic, adCmdTable
    Do While Not (myRS.EOF OR bolAlreadyExists)
    If (StrComp(myRS("username"), Request.Form("username"), _
    vbTextCompare) = 0) Then
    Response.Write "<A HREF='addinguser.asp'>"
    Response.Write "An account already exists with this name. "
    bolAlreadyExists = True
    session("myuser")=""
    End If
    myRS.MoveNext
    Loop


    If Not bolAlreadyExists Then
    myRS.AddNew
    myRS("Password") = Request.Form("Password")
    myRS("username")=Request.Form("username")
    myRS("emailAddress")=Request.Form("emailAddress")
    myRS.Update

    'logging that person in if account successfully created

    strUserName = myRS("username")
    Session("myUser")=strUserName
    response.redirect("success.asp")

    End If

    myRS.Close
    Set myRS = Nothing

    myConn.Close
    Set myConn = Nothing
    %>

  3. #3
    jthayne's Avatar

    Status
    Offline
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    508

    Re: need help with code for registration info to db

    Ok. If I am reading it correctly, when the user first goes to the site and registers, the first code you posted is run, and they register for the site. Then when they come back, they log in using the second code you posted. If I am correct about this, where are they getting the password from?

  4. #4
    4mybsa's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2008
    Location
    Northeast Texas
    Posts
    6

    Re: need help with code for registration info to db

    the passord registration information and file is working correct that is why I did not provide it. what I would like to do it make the proc page above work with the above form (no need to worry about password portion) this form will be filled out after the client has logged in. if you need to know where the passwords are keep in the db the are in table called users the table for the reg form is called registration. does this help you.

  5. #5
    jthayne's Avatar

    Status
    Offline
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    508

    Re: need help with code for registration info to db

    I am pretty sure I understand now.
    Give these changes a shot.

    Payment Registration Form:
    Code:
    <%
    'Verify session exists and that the user is logged in.  Otherwise, redirect to login page
    if Not Session("loginokay") then response.redirect("addinguser.asp")
    
    'Be sure to set Session("loginokay")=true when the user logs in to the site, or they will forever be logging in.
    'You will need to set Session("myUser") to the username upon a successful login as well.
    'Also remember to call Session.Abandon upon logout
    %>
    
    .................
    
    <form id="Adding3" action="addingregproc.asp" method="post">
    
    <INPUT TYPE=HIDDEN NAME="Contact_User_Name" VALUE="<% Response.Write Session("myUser") %>"> <!-- Moved and changed -->
    
    <BLOCKQUOTE>
    <div align="left">
    <PRE><b><font size="3"><EM>First Name </EM><INPUT TYPE=TEXT NAME="Contact_First_Name" SIZE=25>
    <EM>Last Name </EM><INPUT TYPE=TEXT NAME="Contact_Last_Name" SIZE=25>
    <EM>Street Address </EM><INPUT TYPE=TEXT NAME="Contact_Street_Address" SIZE=35>
    <EM>City </EM><INPUT TYPE=TEXT NAME="Contact_City" SIZE=35>
    <EM>State/Province </EM><INPUT TYPE=TEXT NAME="Contact_State" SIZE=35>
    <EM>Zip/Postal Code </EM><INPUT TYPE=TEXT NAME="Contact_Zip_Code" SIZE=12 MAXLENGTH=12>
    <EM>Country </EM><INPUT TYPE=TEXT NAME="Contact_Country" SIZE=25>
    <EM>Home Phone </EM><INPUT TYPE=TEXT NAME="Contact_Home_Phone" SIZE=25 MAXLENGTH=25>
    <EM>PayPal Acct. </EM><INPUT TYPE=TEXT NAME="Contact_PayPal_Acct" SIZE=25 MAXLENGTH=25>
    <EM>E-mail </EM><INPUT TYPE=TEXT NAME="Contact_Email" SIZE=25></font></b></PRE>
    </div>
    
    <center>
    
    <div align="left">
    <PRE><font size="3"><b>How would you like to be paid <u>PayPal</u> or <u>Check</u>? <INPUT TYPE=TEXT NAME="Contact_Payment_Type" SIZE=25></b></font>
    </PRE>
    </div>
    
    </center> <!-- added -->
    </BLOCKQUOTE>
    <p>
    <INPUT TYPE=submit VALUE="Submit Payment Registration"></p>
    
    </form> <!-- added -->
    Old Proc:
    Code:
     <%@ Language=VBScript %>
     <%  Option Explicit %>
    <!-- #INCLUDE FILE = "adovbs.inc" -->
    
    <%
    'for an explanation of the above file, see
       Dim Database, myConn, mySQL
    
    'Connect to the database access.mdb, table is registration
    
       Database="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("*****/accesscustbaseusers.mdb") & ""
    
       Set myConn=Server.CreateObject("ADODB.Connection")
    
    myConn.Open Database
    
      'checking that something was entered for all fields
    
      Dim myRS, bolAlreadyExists, strUserName
       If ((Request.Form("Contact_Email") = "")  OR (Request.Form("Contact_Last_Name") = "")) Then  'Updated Values.  Make sure to add in any additional fields that are required.
          Response.Write "<A HREF='addinguser.asp'>"
          Response.Write "You must enter values for all the fields."
          Response.Write "</A>"
          session("myuser")=""
          Response.end
       end if
    %>
    <!-- #INCLUDE FILE = "emailcheck.asp" -->
    <%
    
    
       'Verifying the user submitting the form is the logged in user.
         If Not (Session("myUser") = Request.Form("Contact_User_Name")) Then
    	response.redirect("paymentreg.asp")
         End If
    
    'Removed the login verification section.  The user has already logged in, so it is unecessary
    
    	response.redirect("success.asp")
    
       myRS.Close
         Set myRS = Nothing
    
       myConn.Close
       Set myConn = Nothing
    %>

  6. #6
    4mybsa's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2008
    Location
    Northeast Texas
    Posts
    6

    Re: need help with code for registration info to db

    Thank you, I got it done. would not work as seperate component so I added all additional fields to original registration page and all works great. Thanks for all your help.

    I do have 1 other question. Is there a way to add a feild to my table that will be a number value only and the contents of this table will increase by 1 everytime a user logs in? (new reg will start @ 1) if you need to see any of the login info let me know and I will post it for you.

  7. #7
    jthayne's Avatar

    Status
    Offline
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    508

    Re: need help with code for registration info to db

    You are wanting an autoincrement field. In Access, you will need to add a new field with a data type of AutoNumber.

  8. #8
    jthayne's Avatar

    Status
    Offline
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    508

    Re: need help with code for registration info to db

    And glad you were able to get it working.



Tags for this Thread