<--- STEP 2 --->

<!--- Check to see if User Selected username already exists again just
in case it was taken between submissions. If it does exist, don't
submit data --->
<CFQUERY NAME="member_lookup" DATASOURCE="members" MAXROWS=1>

        SELECT member_id, user_name

        FROM tbl_member_core

        WHERE user_name = <cfqueryparam value="#FORM.user_name#">
        ;

</CFQUERY>
<!--- --->

<!--- If user lookup doesn't yield a matching username, proceed to
insert userdata into database. --->
<CFIF member_lookup.recordcount eq 0>

        <!--- Create core database entry then fetch ID for new member to be
used in creating other database entries--->
        <CFTRANSACTION>

                <CFQUERY NAME="create_account_a" DATASOURCE="members">

                        INSERT INTO tbl_member_core
                        (user_name,
                        type,
                        password,
                        password_hint           )

                        VALUES
                        (<cfqueryparam value="#FORM.user_name#">,
                        <cfqueryparam value="#FORM.type#">,
                        <cfqueryparam value="#FORM.password#">,
                        <cfqueryparam value="#FORM.password_hint#">
                        )

                        ;

                </CFQUERY>

                <CFQUERY NAME="new_member_id" DATASOURCE="members">

                        SELECT MAX(member_id) AS id

                        FROM tbl_member_core
                        ;

                </CFQUERY>

        </CFTRANSACTION>
        <!--- --->

        <!---Create new member profile entry and insert provided data--->
        <CFQUERY NAME="create_member_profile" datasource="members">

                INSERT INTO tbl_member_profiles

                (member_id,
                sex,
                birthday,
                db_list,
                ad_show,
                profile_show,
                here_for_trading,
                here_for_friends,
                here_for_dating,
                here_for_networking,
                here_for_serious_relationships,
                phone_number_a_show,
                phone_number_b_show,
                location_show,
                general_interests_show,
                music_show,
                movies_show,
                television_show,
                books_show,
                heroes_show
                )

                VALUES
                (<cfqueryparam value="#new_member_id.id#">,
                '',
                <cfqueryparam value="#FORM.member_birthday#">,
                '1',
                '1',
                '1',
                '1',
                '1',
                '0',
                '1',
                '0',
                '0',
                '0',
                '1',
                '0',
                '0',
                '0',
                '0',
                '0',
                '0'

                )

                ;

        </CFQUERY>
        <!--- --->

        <!--- Create Primary Address entry for user then fetch new primary
address ID to be inserted into core table--->
        <CFTRANSACTION>

                <CFQUERY NAME="create_primary_address" DATASOURCE="members">

                        INSERT INTO tbl_member_contacts

                        (member_id,
                        full_name,
                        address_a,
                        address_b,
                        city,
                        state,
                        country,
                        postal,
                        phone_number,
                        phone_number_type,
                        email
                        )

                        VALUES
                        (<cfqueryparam value="#new_member_id.id#">,
                        <cfqueryparam value="#FORM.first_name# 
#FORM.last_name#">,
                        '',
                        '',
                        '',
                        '',
                        '',
                        '',
                        '',
                        '',
                        <cfqueryparam value="#FORM.email_a#">
                        )

                        ;

                </CFQUERY>


                <CFQUERY NAME="get_primary_contact_id" DATASOURCE="members">

                        SELECT MAX(contact_id) AS id

                        FROM tbl_member_contacts
                        ;

                </CFQUERY>


                <CFQUERY NAME="create_core_contact" DATASOURCE="members">

                        INSERT INTO tbl_member_core_contact

                        (member_id,
                        primary_contact_id,
                        organization,
                        first_name,
                        last_name,
                        middle_initial ,
                        email_a
                        )

                        VALUES
                        (<cfqueryparam value="#new_member_id.id#">,
                        <cfqueryparam value="#get_primary_contact_id.id#">,
                        '',
                        <cfqueryparam value="#FORM.first_name#">,
                        <cfqueryparam value="#FORM.last_name#">,
                        <cfqueryparam value="#FORM.middle_initial#">,
                        <cfqueryparam value="#FORM.email_a#">
                        )

                        ;

                </CFQUERY>

        </CFTRANSACTION>
        <!--- --->

        <!--- Create URL redirect entry for user - company.com/username --->
        <CFQUERY name="create_primary_profile_redirect" datasource="dns">

                INSERT INTO tbl_dns

                (dns_member_id,
                dns_domain,
                dns_subfolder,
                dns_redirect_url,
                dns_status
                )

                VALUES

                (<cfqueryparam value="#new_member_id.id#">,
                'company.com',
                <cfqueryparam value="#FORM.user_name#">,
                <cfqueryparam value="http://company.com/members/members.cfm?
fuseaction=mpv1&name=#FORM.user_name#">,
                1
                )
                ;

        </CFQUERY>
        <!--- --->

        <!--- Set member status to 'new' --->
        <CFQUERY name="create_member_status" datasource="members">

                INSERT INTO tbl_member_status

                (member_id,
                status
                )

                VALUES

                (<cfqueryparam value="#new_member_id.id#">,
                'new'
                )
                ;

        </CFQUERY>
        <!--- --->


        <!--- Create Folder on Image Server to host profile pics--->
        <CFDIRECTORY

                action="create"
                directory="c:\openbd\webapps\company_com\imagehost\profiles
\#new_member_id.id#"

                >
        <!--- --->

        <!--- create table record and insert user about me info into about me
table --->
        <CFQUERY name="create_profile_about_me" datasource="members">

                INSERT INTO tbl_member_profile_about_me
                        (member_id
                        )

                VALUES
                        (<cfqueryparam value="#new_member_id.id#">
                        )

                        ;

        </CFQUERY>
        <!--- --->


        <!--- create table record and insert changelog info into changelog
table --->
        <CFQUERY name="create_member_changelog" datasource="members">

                INSERT INTO tbl_member_changelog

                (member_id,
                created,
                created_ip
                )

                VALUES

                (<cfqueryparam value="#new_member_id.id#">,
                <cfqueryparam value="#Now()#" cfsqltype="CF_SQL_DATE">,
                <cfqueryparam value="#CGI.remote_addr#">
                )
                ;

        </CFQUERY>
        <!--- --->


<!--- create event declaring new registration--->
        <CFINCLUDE template="/www/members/events/new_registration.cfm">
<!--- --->

<!--- Display Successful registration message to user telling them to
check their email--->
<div id="content">
<h1><b>member:</b> registration</h1>

<span class="largetext">
<CFOUTPUT>
#FORM.first_name#,
</CFOUTPUT>
</span>

<br>
<br>

<span class="largetext">
Thank you for your submission.  We have sent an email to the email
address you provided.
Please check for this email, read the contents, and click the account
verification link.
This will activate your account and allow you to log into the
company.com system.
<br>
<br>
If you fail to receive this email, perhaps the email address you
provided was incorrect, or a software
component on our system has failed.  In any case, please verify your
email account, and if you
still have questions or need assistance, please send an email to
[email protected].
<br>
<br>
Sincerely,

The company.com Support Team.
</span>
</DIV>
<!--- --->


<!--- generate and send email thanking user for registration and
asking them to click on the included link
to verify their email address--->

        <CFMAIL
                TO="#FORM.email_a#"
                FROM= "[email protected]"
                SUBJECT="company.com Account Verification"
                SERVER="216.198.192.200">

#FORM.first_name#,

Thanks again for registering with company.com.  Please click the link
below to activate your account.
You should be taken to the login page where you should be able to log
into your account.  If you still have
questions or need assistance, please send an email to
[email protected].

Click the link below to activate your account.

http://company.com/members/accounts/registration/activateaccount.cfm?id=#new_member_id.id#

        </CFMAIL>

        <!--- --->

<!--- If query for username yields a match declaring that username is
already taken, tell User that registration
has already been submitted for the username they requested.--->
<CFELSE>

<div id="content">
<h1><b>member:</b> registration</h1>

<br>
<br>

<span class="largetext">
Submission for this account has already been placed. Please check your
email for the verification email that was sent out
after registration. If you believe you have received this message in
error, please use our contact page to inform us and we will
investigate.


<br>
<br>
Sincerely,

The company.com Support Team.
</span>
</DIV>

</CFIF>

<!--- --->

-- 
Open BlueDragon Public Mailing List
 http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
 mailing list - http://groups.google.com/group/openbd?hl=en

 !! save a network - please trim replies before posting !!

Reply via email to