VerifyMark="(*)";
/*
* Define the name of the form to be used for example in Javascript
* validation code generated by the class.
*/
$form->NAME="subscription_form";
/*
* Use the GET method if you want to see the submitted values in the form
* processing URL, or POST otherwise.
*/
$form->METHOD="POST";
/*
* Make the form be displayed and also processed by this script.
*/
$form->ACTION="";
/*
* Specify a debug output function you really want to output any
* programming errors.
*/
$form->debug="trigger_error";
/*
* Define a warning message to display by Javascript code when the user
* attempts to submit the this form again from the same page.
*/
$form->ResubmitConfirmMessage=
"Are you sure you want to submit this form again?";
/*
* Output previously set password values
*/
$form->OutputPasswordValues=1;
/*
* Output multiple select options values separated by line breaks
*/
$form->OptionsSeparator="
\n";
/*
* Output all validation errors at once.
*/
$form->ShowAllErrors=1;
/*
* CSS class to apply to all invalid inputs.
* Set to a non-empty string to specify the invalid input CSS class
*/
$form->InvalidCLASS='invalid';
/*
* Style to apply to all invalid inputs when you just want to override a
* few style attributes, instead of replacing the CSS class
* Set to a non-empty string to specify the invalid input style attributes
*
* $form->InvalidSTYLE='background-color: #ffcccc; border-color: #000080';
*
*/
/*
* Text to prepend and append to the validation error messages.
*/
$form->ErrorMessagePrefix="- ";
$form->ErrorMessageSuffix="";
/*
* Define the form field properties even if they may not be displayed.
*/
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"FirstName",
"ID"=>"FirstName",
"MAXLENGTH"=>60,
"SIZE"=>40,
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"This is not a valid first name.",
"LABEL"=>"First name",
"ACCESSKEY"=>"F"
));
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"LastName",
"ID"=>"LastName",
"MAXLENGTH"=>60,
"SIZE"=>40,
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"This is not a valid last name.",
"LABEL"=>"Last name",
"ACCESSKEY"=>"L"
));
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"StreetAddress",
"ID"=>"StreetAddress",
"MAXLENGTH"=>60,
"SIZE"=>60,
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"This is not a valid Street Address.",
));
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"City",
"ID"=>"City",
"MAXLENGTH"=>60,
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"This is not a valid City.",
));
$form->AddInput(array(
"TYPE"=>"select",
"NAME"=>"State",
"ID"=>"State",
"VALUE"=>"pick",
"SIZE"=>1,
"OPTIONS"=>$ArrStates,
"ValidateAsDifferentFromText"=>"pick",
"ValidateAsDifferentFromTextErrorMessage"=>
"Choose a template from the list for your site",
"ValidationErrorMessage"=>"A template was not selected.",
"LABEL"=>"Site Template"
));
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"Zip",
"ID"=>"Zip",
"MAXLENGTH"=>5,
"SIZE"=>5,
"ValidateAsNotEmpty"=>1,
"ValidateMinimumLength"=>5,
"ValidationErrorMessage"=>"This is not a valid Zip code.",
));
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"WebID",
"ID"=>"WebID",
//"MAXLENGTH"=>5,
"SIZE"=>10,
//"ValidateAsNotEmpty"=>1,
//"ValidateMinimumLength"=>5,
//"ValidationErrorMessage"=>"This is not a valid Zip code.",
));
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"ContactPhone",
"ID"=>"ContactPhone",
"MAXLENGTH"=>15,
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"Please enter a Contact Phone number.",
"LABEL"=>"Phone Number",
));
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"OtherPhone",
"ID"=>"OtherPhone",
"MAXLENGTH"=>15,
));
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"ReferralName",
"ID"=>"ReferralName",
"MAXLENGTH"=>80,
"SIZE"=>40,
));
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"LeaderName",
"ID"=>"LeaderName",
"MAXLENGTH"=>80,
"SIZE"=>40,
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"This is not a valid Referral Name.",
));
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"Email",
"ID"=>"Email",
"MAXLENGTH"=>100,
"SIZE"=>45,
"Capitalization"=>"lowercase",
"ValidateAsEmail"=>1,
"ValidationErrorMessage"=>"Please enter a valid e-mail address.",
"LABEL"=>"E-mail address",
"ACCESSKEY"=>"E"
));
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"DomainName",
"ID"=>"DomainName",
"MAXLENGTH"=>100,
"SIZE"=>50,
"Capitalization"=>"lowercase",
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"This is not a Domain Name",
"ValidationServerFunction"=>"CheckValidDomainName",
"ValidationServerFunctionErrorMessage"=>"The Domain name you entered is already being used."
));
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"ExistDomainName",
"ID"=>"ExistDomainName",
"MAXLENGTH"=>100,
"SIZE"=>50,
"Capitalization"=>"lowercase",
));
/*-- Save
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"UserID",
"ID"=>"UserID",
"MAXLENGTH"=>20,
"Capitalization"=>"lowercase",
"ValidateRegularExpression"=>array(
"^[a-zA-Z]",
"^[a-zA-Z0-9]+\$"
),
"ValidateRegularExpressionErrorMessage"=>array(
"The Login ID must start with a letter.",
"The Login ID may only contain letters and digits."
),
"ValidateAsNotEmpty"=>1,
"ValidateAsNotEmptyErrorMessage"=>"You must enter a valid Login ID",
"ValidateMinimumLength"=>6,
"ValidateMaximumLength"=>12,
"ValidateMinimumLengthErrorMessage"=>"The Login ID must be at least 6 characters long",
"ValidateMaximumLengthErrorMessage"=>"The Login ID must be less than 12 characters long",
"LABEL"=>"Login ID",
//"ValidationServerFunction"=>"CheckValidUsername",
"ValidationServerFunctionErrorMessage"=>"The LoginID you entered has already been taken."
));
--*/
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"UserID",
"ID"=>"UserID",
"MAXLENGTH"=>20,
"Capitalization"=>"lowercase",
"ValidateRegularExpression"=>array(
"^[a-zA-Z]",
"^[a-zA-Z0-9]+\$"
),
"ValidateRegularExpressionErrorMessage"=>array(
"The Email must start with a letter.",
"The Email may only contain letters and digits."
),
"ValidateAsNotEmpty"=>1,
"ValidateAsNotEmptyErrorMessage"=>"You must enter a valid Email name",
"ValidateMinimumLength"=>6,
"ValidateMinimumLengthErrorMessage"=>"The Email must be at least 6 characters long",
"LABEL"=>"Login ID",
"ValidationServerFunction"=>"CheckValidUsername",
"ValidationServerFunctionErrorMessage"=>"The Email you entered has already been taken."
));
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"ContactInfo",
"ID"=>"ContactInfo",
"MAXLENGTH"=>78,
"SIZE"=>100,
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"Please enter your contact Info.",
));
$form->AddInput(array(
"TYPE"=>"select",
"NAME"=>"TemplateChoice",
"ID"=>"TemplateChoice",
"VALUE"=>"pick",
"SIZE"=>1,
"OPTIONS"=>$TemplatesArray,
"ValidateAsDifferentFromText"=>"pick",
"ValidateAsDifferentFromTextErrorMessage"=>
"Choose a template from the list for your site",
"ValidationErrorMessage"=>"A template was not selected.",
"LABEL"=>"Site Template"
));
$form->AddInput(array(
"TYPE"=>"textarea",
"NAME"=>"ClientIntro",
"ID"=>"ClientIntro",
"COLS"=>110,
"ROWS"=>10,
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"Please enter an introduction paragraph.",
));
$form->AddInput(array(
"TYPE"=>"textarea",
"NAME"=>"GraphicsPrefs",
"ID"=>"GraphicsPrefs",
"COLS"=>110,
"ROWS"=>10,
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"Please enter your custom graphic preferences.",
));
/*--
$form->AddInput(array(
"TYPE"=>"password",
"NAME"=>"Password",
"ID"=>"Password",
"ONCHANGE"=>"if(value.toLowerCase) value=value.toLowerCase()",
"ValidateAsNotEmpty"=>1,
"ValidationErrorMessage"=>"Not a valid password.",
"ReadOnlyMark"=>"********"
));
$form->AddInput(array(
"TYPE"=>"password",
"NAME"=>"ConfirmPassword",
"ID"=>"ConfirmPassword",
"ONCHANGE"=>"if(value.toLowerCase) value=value.toLowerCase()",
"ValidateAsEqualTo"=>"Password",
"ValidationErrorMessage"=>
"The passwords do not match.",
"ReadOnlyMark"=>"********"
));
$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"Reminder",
"ID"=>"Reminder",
"ValidateAsNotEmpty"=>1,
"ValidateAsNotEmptyErrorMessage"=>
"Please provide a password reminder phrase.",
"ValidateAsDifferentFrom"=>"password",
"ValidateAsDifferentFromErrorMessage"=>
"The reminder phrase may not be equal to the password.",
));
--*/
$form->AddInput(array(
"TYPE"=>"checkbox",
"NAME"=>"agree",
"ID"=>"agree",
"VALUE"=>"Yes",
"ValidateAsSet"=>1,
"ValidateAsSetErrorMessage"=>"You have not agreed with the subscription terms.",
"LABEL"=>"Agree with the terms",
"ACCESSKEY"=>"t"
));
$form->AddInput(array(
"TYPE"=>"submit",
"ID"=>"button_subscribe",
"VALUE"=>"Submit Subscription",
));
/*
* Give a name to hidden input field so you can tell whether the form is to
* be outputted for the first or otherwise it was submitted by the user.
*/
$form->AddInput(array(
"TYPE"=>"hidden",
"NAME"=>"doit",
"VALUE"=>1
));
/*
* Hidden fields can be used to pass context values between form pages,
* like for instance database record identifiers or other information
* that may help your application form processing scripts determine
* the context of the information being submitted with this form.
*
* You are encouraged to use the DiscardInvalidValues argument to help
* preventing security exploits performed by attackers that may spoof
* invalid values that could be used for instance in SQL injection attacks.
*
* In this example, any value that is not an integer is discarded. If the
* value was meant to be used in a SQL query, with this attack prevention
* measure an attacker cannot submit SQL code that could be used to make
* your SQL query retrieve unauthorized information to abuse your system.
*/
$form->AddInput(array(
"TYPE"=>"hidden",
"NAME"=>"user_track",
"VALUE"=>"0",
"ValidateAsInteger"=>1,
"DiscardInvalidValues"=>1
));
/*
* The following lines are for testing purposes.
* Remove these lines when adapting this example to real applications.
*/
if(defined("__TEST"))
{
if(IsSet($__test_options["ShowAllErrors"]))
$form->ShowAllErrors=$__test_options["ShowAllErrors"];
if(IsSet($__test_options["ErrorMessagePrefix"]))
$form->ErrorMessagePrefix=$__test_options["ErrorMessagePrefix"];
if(IsSet($__test_options["ErrorMessageSuffix"]))
$form->ErrorMessageSuffix=$__test_options["ErrorMessageSuffix"];
}
/*
* Load form input values eventually from the submitted form.
*/
$form->LoadInputValues($form->WasSubmitted("doit"));
/*
* Empty the array that will list the values with invalid field after validation.
*/
$verify=array();
/*
* Check if the global array variable corresponding to hidden input field is
* defined, meaning that the form was submitted as opposed to being displayed
* for the first time.
*/
if($form->WasSubmitted("doit"))
{
/*
* Therefore we need to validate the submitted form values.
*/
if(($error_message=$form->Validate($verify))=="")
{
/*
* It's valid, set the $doit flag variable to 1 to tell the form is ready to
* processed.
*/
$doit=1;
}
else
{
/*
* It's invalid, set the $doit flag to 0 and encode the returned error message
* to escape any HTML special characters.
*/
$doit=0;
$error_message=nl2br(HtmlSpecialChars($error_message));
}
}
else
{
/*
* The form is being displayed for the first time, so it is not ready to be processed
* and there is no error message to display.
*/
$error_message="";
$doit=0;
}
if($doit)
{
/*
* The form is ready to be processed, just output it again as read only to
* display the submitted values. A real form processing script usually may
* do something else like storing the form values in a database.
*/
$form->ReadOnly=1;
/*--
$sql = "INSERT INTO MemberTable "
."(UserID, FirstName, LastName, StreetAddress, City, State, Zip, ContactPhone, OtherPhone, Email, LeaderName, TemplateID, "
."DomainName, ExistDomainName, ReferralName, CreateDate, ContactInfo, ClientIntro, GraphicsPrefs)"
." VALUES "
."("
.'"'.$form->GetInputValue("UserID").'", '
//."'".md5($form->GetInputValue("Password"))."', "
//."'".$form->GetInputValue("Reminder")."', "
.'"'.$form->GetInputValue("FirstName").'", '
.'"'.$form->GetInputValue("LastName").'", '
.'"'.$form->GetInputValue("StreetAddress").'", '
.'"'.$form->GetInputValue("City").'", '
.'"'.$form->GetInputValue("State").'", '
.'"'.$form->GetInputValue("Zip").'", '
.'"'.$form->GetInputValue("ContactPhone").'", '
.'"'.$form->GetInputValue("OtherPhone").'", '
.'"'.$form->GetInputValue("Email").'", '
.'"'.$form->GetInputValue("LeaderName").'", '
.'"'.$form->GetInputValue("TemplateChoice").'", '
.'"'.$form->GetInputValue("DomainName").'", '
.'"'.$form->GetInputValue("ExistDomainName").'", '
.'"'.$form->GetInputValue("ReferralName").'", '
."NOW(), "
.'"'.$form->GetInputValue("ContactInfo").'", '
.'"'.nl2br(HtmlSpecialChars($form->GetInputValue("ClientIntro"))).'", '
.'"'.$form->GetInputValue("GraphicsPrefs").'"'
.")";
--*/
$sql = "INSERT INTO MemberTable "
."(UserID, FirstName, LastName, StreetAddress, City, State, Zip, ContactPhone, OtherPhone, Email, LeaderName, WebID, TemplateID, "
."DomainName, ExistDomainName, ReferralName, CreateDate, ContactInfo, ClientIntro, GraphicsPrefs)"
." VALUES "
."("
."'".$form->GetInputValue("UserID")."', "
//."'".md5($form->GetInputValue("Password"))."', "
//."'".$form->GetInputValue("Reminder")."', "
."'".addslashes($form->GetInputValue("FirstName"))."', "
."'".addslashes($form->GetInputValue("LastName"))."', "
."'".$form->GetInputValue("StreetAddress")."', "
."'".addslashes($form->GetInputValue("City"))."', "
."'".$form->GetInputValue("State")."', "
."'".$form->GetInputValue("Zip")."', "
."'".$form->GetInputValue("ContactPhone")."', "
."'".$form->GetInputValue("OtherPhone")."', "
."'".$form->GetInputValue("Email")."', "
."'".addslashes($form->GetInputValue("LeaderName"))."', "
."'".addslashes($form->GetInputValue("WebID"))."', "
."'".$form->GetInputValue("TemplateChoice")."', "
."'".$form->GetInputValue("DomainName")."', "
."'".$form->GetInputValue("ExistDomainName")."', "
."'".addslashes($form->GetInputValue("ReferralName"))."', "
."NOW(), "
."'".$form->GetInputValue("ContactInfo")."', "
."'".addslashes(nl2br(HtmlSpecialChars($form->GetInputValue("ClientIntro"))))."', "
."'".addslashes($form->GetInputValue("GraphicsPrefs"))."'"
.")";
$result = mysql_query($sql) or die(mysql_error()." :: SQL QUery".$sql);
// Send an Email
$tplid = $form->GetInputValue("TemplateChoice");
$emsg = "UserID: ".$form->GetInputValue("UserID")
."
Name: ".$form->GetInputValue("FirstName")." ".$form->GetInputValue("LastName")
."
Address: ".$form->GetInputValue("StreetAddress")
."
City: ".$form->GetInputValue("City")
."
State: ".$form->GetInputValue("State")
."
Zip: ".$form->GetInputValue("Zip")
."
Phone: ".$form->GetInputValue("ContactPhone")
."
Other Phone: ".$form->GetInputValue("OtherPhone")
."
Email: ".$form->GetInputValue("Email")
."
Leader: ".$form->GetInputValue("LeaderName")
."
webID: ".$form->GetInputValue("WebID")
."
Domain Name: ".$form->GetInputValue("DomainName")
."
Existing Domain: ".$form->GetInputValue("ExistDomainName")
."
Referral Name: ".$form->GetInputValue("ReferralName")
."
Template: ".$TemplatesArray[$tplid]
."
"
."Gfx Prefs: ".$form->GetInputValue("GraphicsPrefs");
SndMailNewReg($emsg);
header('Location: thanks.html');
}
/*
* If the form was not submitted or was not valid, make the page ONLOAD
* event give the focus to the first form field or the first invalid field.
*/
if(!$doit)
{
if(strlen($error_message))
{
/*
* If there is at least one field with invalid values, get the name of the
* first field in error to make it get the input focus when the page is
* loaded.
*/
Reset($verify);
$focus=Key($verify);
}
else
{
/*
* Make the email field get the input focus when the page is loaded
* if there was no previous validation error.
*/
$focus='FirstName';
}
/*
* Connect the form to the field to get the input focus when the page
* loads.
*/
$form->ConnectFormToInput($focus, 'ONLOAD', 'Focus', array());
}
$onload = HtmlSpecialChars($form->PageLoad());
?>