<!---- If the desired account type is declared in the URL as variable
url ACT,
set local variable ACT to equal supplied url variable--->
<CFIF isDefined("URL.act")>
<CFSET ACT = "#URL.act#">
</CFIF>
<!--- --->
<!--- Set system dependant form variables to defaults --->
<CFSET showform = 1>
<CFSET accountconfirm = 0>
<CFSET type_error = 0>
<CFSET user_name_error = 0>
<CFSET user_name_check_error = 0>
<CFSET user_name_sc_error = 0>
<CFSET user_name_length_long_error = 0>
<CFSET user_name_length_short_error = 0>
<CFSET password_error = 0>
<CFSET password_length_long_error = 0>
<CFSET password_length_short_error = 0>
<CFSET confirm_password_error = 0>
<CFSET password_match_error = 0>
<CFSET password_hint_error = 0>
<CFSET organization_error = 0>
<CFSET first_name_error = 0>
<CFSET last_name_error = 0>
<CFSET birthday_day_error = 0>
<CFSET birthday_month_error = 0>
<CFSET birthday_year_built_error = 0>
<CFSET member_age_under_18_error = 0>
<CFSET email_a_error = 0>
<CFSET email_a_bad_email_error = 0>
<CFSET confirm_email_a_error = 0>
<CFSET confirm_email_a_bad_email_error = 0>
<CFSET email_match_error = 0>
<CFSET birthday_date = 0>
<!--- --->
<!--- Declare and set user defined form variables to defaults --->
<CFPARAM NAME="FORM.type" default="basic">
<CFPARAM NAME="FORM.user_name" default="">
<CFPARAM NAME="FORM.password" default="">
<CFPARAM NAME="FORM.confirm_password" default="">
<CFPARAM NAME="FORM.password_hint" default="">
<CFPARAM NAME="FORM.organization" default="">
<CFPARAM NAME="FORM.first_name" default="">
<CFPARAM NAME="FORM.middle_initial" default="">
<CFPARAM NAME="FORM.last_name" default="">
<CFPARAM NAME="FORM.birthday_day" default="%">
<CFPARAM NAME="FORM.birthday_month" default="%">
<CFPARAM NAME="FORM.birthday_year" default="%">
<CFPARAM NAME="FORM.phone_number" default="">
<CFPARAM NAME="FORM.phone_number_type" default="%">
<CFPARAM NAME="FORM.email_a" default="">
<CFPARAM NAME="FORM.confirm_email_a" default="">
<!--- --->
<!--- Check to see if username declared in FORM.user_name by user is
already taken --->
<CFQUERY NAME="USER_NAME_CHECK" DATASOURCE="members" MAXROWS=1 >
SELECT user_name
FROM tbl_member_core
WHERE user_name = <cfqueryparam value="#FORM.user_name#">
;
</CFQUERY>
<!--- --->
<!--- If user has submitted form, check supplied form values against
rules and if bad values are found,
set related error values to 1. If any required values are flagged as
error'd, the process that follows
will not let the form pass, and will ask user to correct their
entries--->
<CFIF isDefined("FORM.submit")>
<CFIF Trim(FORM.type) EQ "%">
<CFSET type_error = 1>
</CFIF>
<CFIF Trim(FORM.user_name) EQ "">
<CFSET user_name_error = 1>
</CFIF>
<CFSET newname = ReplaceList(FORM.user_name,"!,@,##,$,%,^,&,*,(,),
+,-,=,`,~,{,},|,[,],\,:,"",;,',<,>,?,.,/",",,,,,,,,,,,,,,,,,,,,,,,,")>
<CFIF len(FORM.user_name) NEQ len(newname)>
<CFSET user_name_sc_error = 1>
</CFIF>
<CFSET FORM.user_name = ReplaceList(FORM.user_name, "!,@,##,$,%,^,&,*,
(,),+,-,=,`,~,{,},|,[,],
\,:,"",;,',<,>,?,.,/",",,,,,,,,,,,,,,,,,,,,,,,,")>
<CFIF NOT len(FORM.user_name) lte 31 and Trim(FORM.user_name) NEQ "">
<CFSET user_name_length_long_error = 1>
</CFIF>
<CFIF NOT len(FORM.user_name) gt 2 and Trim(FORM.user_name) NEQ "">
<CFSET user_name_length_short_error = 1>
</CFIF>
<CFIF Trim(FORM.password) EQ "">
<CFSET password_error = 1>
</CFIF>
<CFIF len(FORM.password) gt 18 AND Trim(FORM.password) NEQ "">
<CFSET password_length_long_error = 1>
</CFIF>
<CFIF len(FORM.password) lt 4 AND Trim(FORM.password) NEQ "">
<CFSET password_length_short_error = 1>
</CFIF>
<CFIF FORM.password NEQ FORM.confirm_password AND Trim(FORM.password)
NEQ "" AND Trim(FORM.confirm_password) NEQ "">
<CFSET password_match_error = 1>
</CFIF>
<CFIF Trim(FORM.confirm_password) EQ "">
<CFSET confirm_password_error = 1>
</CFIF>
<CFIF Trim(FORM.password_hint) EQ "">
<CFSET password_hint_error = 1>
</CFIF>
<CFIF Trim(FORM.type) EQ "nonprofit" AND Trim(FORM.organization) EQ
"">
<CFSET organization_error = 1>
</CFIF>
<CFSET FORM.first_name = ReplaceList(FORM.first_name, "!,@,##,$,
%,^,&,*,(,),+,-,=,`,~,{,},|,[,],
\,:,"",;,',<,>,?,.,/",",,,,,,,,,,,,,,,,,,,,,,,,")>
<CFIF Trim(FORM.first_name) EQ "">
<CFSET first_name_error = 1>
</CFIF>
<CFSET FORM.middle_initial = ReplaceList(FORM.middle_initial ,
"!,@,##,$,%,^,&,*,(,),+,-,=,`,~,{,},|,[,],
\,:,"",;,',<,>,?,.,/",",,,,,,,,,,,,,,,,,,,,,,,,")>
<CFSET FORM.last_name = ReplaceList(FORM.last_name, "!,@,##,$,%,^,&,*,
(,),+,-,=,`,~,{,},|,[,],
\,:,"",;,',<,>,?,.,/",",,,,,,,,,,,,,,,,,,,,,,,,")>
<CFIF Trim(FORM.last_name) EQ "">
<CFSET last_name_error = 1>
</CFIF>
<CFIF Trim(FORM.birthday_day) EQ "%">
<CFSET birthday_day_error = 1>
</CFIF>
<CFIF Trim(FORM.birthday_month) EQ "%">
<CFSET birthday_month_error = 1>
</CFIF>
<CFIF Trim(FORM.birthday_year) EQ "%">
<CFSET birthday_year_built_error = 1>
</CFIF>
<CFIF (birthday_day_error NEQ 1) and (birthday_month_error NEQ 1) and
(birthday_year_built_error NEQ 1)>
<CFSET birthday_date = createdatetime
( "#FORM.birthday_year#","#FORM.birthday_month#","#FORM.birthday_day#",
0000,00,00)>
<CFSET member_age = "#datediff("yyyy", birthday_date, now())#">
<CFIF member_age LT "18">
<CFSET member_age_under_18_error = 1>
<CFSET FORM.type = "Basic">
</CFIF>
</CFIF>
<CFIF Trim(FORM.email_a) EQ "">
<CFSET email_a_error = 1>
</CFIF>
<CFIF ((email_a_error eq 0) AND ((find('@',FORM.email_a) eq 0) OR
(find('.',FORM.email_a) eq 0) OR (FORM.email_a EQ "")))>
<CFSET email_a_bad_email_error = 1>
</CFIF>
<CFIF Trim(FORM.confirm_email_a) EQ "">
<CFSET confirm_email_a_error = 1>
</CFIF>
<CFIF (FORM.email_a NEQ FORM.confirm_email_a) AND
FORM.confirm_email_a NEQ "">
<CFSET email_match_error = 1>
</CFIF>
<CFIF (find('@',FORM.confirm_email_a) eq 0) OR (find
('.',FORM.confirm_email_a) eq 0) OR (FORM.confirm_email_a EQ "")>
<CFSET confirm_email_a_bad_email_error = 1>
</CFIF>
<CFIF USER_NAME_CHECK.recordcount EQ 1>
<CFSET user_name_check_error = 1>
</CFIF>
<!--- Check status of error variables. If not errors are found, set
'showform' = false
and pass the data to be submitted. --->
<CFIF
(type_error EQ 0)
AND
(user_name_error EQ 0)
AND
(user_name_check_error EQ 0)
AND
(user_name_sc_error EQ 0)
AND
(user_name_length_long_error EQ 0)
AND
(user_name_length_short_error EQ 0)
AND
(password_error EQ 0)
AND
(confirm_password_error EQ 0)
AND
(password_match_error EQ 0)
AND
(password_hint_error EQ 0)
AND
(organization_error EQ 0)
AND
(first_name_error EQ 0)
AND
(last_name_error EQ 0)
AND
(birthday_day_error EQ 0)
AND
(birthday_month_error EQ 0)
AND
(birthday_year_built_error EQ 0)
AND
(email_a_error EQ 0)
AND
(email_match_error EQ 0)
AND
(email_a_bad_email_error EQ 0)
AND
(confirm_email_a_bad_email_error EQ 0)
>
<CFSET showForm = "false">
</CFIF>
<!--- --->
</CFIF>
<!--- --->
<!--- Show registration form if 'showform' eq 1, so that users can
enter data --->
<CFIF showform EQ 1>
<!---Start of Form--->
<CFFORM action="http://company.com/members/accounts/registration/
register.cfm?fuseaction=step1_short" METHOD="post">
<INPUT class="input" type="hidden" name="ACT" value="#ACT#">
<div id="content"> <!--- FORM DISPLAY CONTENT HERE --->
</div> <!-- end div id content -->
<!--- END OF FORM --->
</CFFORM>
<!--- Start of Verification Form, where user sees supplied data AFTER
having passed error checks. --->
<CFELSE>
<!--- check supplied account type and if qualifies, pass user to
credit card verification
page after they approve their submission. If account type does
not
qualify, user is passed straight to confirmation.
This process changes the formaction url set in the verification
form. --->
<CFIF
(FORM.type EQ "standard")
or
(FORM.type EQ "extended")
or
(FORM.type EQ "power")
or
(FORM.type EQ "super")
or
(FORM.type EQ "merchant")
>
<CFSET
FORMaction="http://company.com/members/accounts/registration/
register.cfm?fuseaction=cc_verification">
<CFELSE>
<CFSET
FORMaction="http://company.com/members/accounts/registration/
register.cfm?fuseaction=step2_short">
</CFIF>
<!--- --->
<!--- set form action for verification form, using variable
declared
in lines above as value for action parameter--->
<CFFORM action="#FORMACTION#" METHOD="post">
<!--- --->
<!--- Declared Form values to be passed for database
submission--->
<CFOUTPUT>
<INPUT class="input" type="hidden" name="type"
value="#FORM.type#">
<INPUT class="input" type="hidden" name="user_name"
value="#FORM.user_name#">
<INPUT class="input" type="hidden" name="password"
value="#FORM.password#">
<INPUT class="input" type="hidden" name="password_hint"
value="#FORM.password_hint#">
<INPUT class="input" type="hidden" name="first_name"
value="#FORM.first_name#">
<INPUT class="input" type="hidden" name="middle_initial"
value="#FORM.middle_initial#">
<INPUT class="input" type="hidden" name="last_name"
value="#FORM.last_name#">
<INPUT class="input" type="hidden"
name="member_birthday"
value="#birthday_date#">
<INPUT class="input" type="hidden" name="email_a"
value="#FORM.email_a#">
</CFOUTPUT>
<!--- --->
<!--- Display user data to be verified prior to submission --->
<div id="content">
</div> <!-- end div id content -->
<!--- End display of verification data--->
</CFFORM>
<!--- End Verification Form --->
</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 !!