$SubKey = $_POST[‘subIndexID’];
$url = “http://www.tcg.org/auth/wp/register.cfc?method=GetRegType&returnformat=plain&subkey=” .$SubKey;
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
$xml = curl_exec($ch);
curl_close($ch);
$parsed = new SimpleXMLElement($xml);
foreach( $parsed as $Regtype )
{
$ID = $Regtype->uniqueID;
$ProdName = $Regtype->ProductName;
$SubType = $Regtype->SubType;
$NumIssues = $Regtype->NumIssues;
$Desc = $Regtype->desc;
$Desc_short = $Regtype->desc_short;
$Price = $Regtype->price;
$SubLoc = $Regtype->SubLoc;
$LocValue = $Regtype->locValue;
}
$submit = $_POST[‘submit’];
$firstname = strip_tags($_POST[‘firstname’]);
$lastname = strip_tags($_POST[‘lastname’]);
$company = strip_tags($_POST[‘company’]);
$address1 = strip_tags($_POST[‘address_1’]);
$address2 = strip_tags($_POST[‘address_2’]);
$city = strip_tags($_POST[‘city’]);
$state = strip_tags($_POST[‘state’]);
$postalcode = strip_tags($_POST[‘postalcode’]);
$country = strip_tags($_POST[‘country’]);
$studentidgraduationyear = strip_tags($_POST[‘studentidgraduationyear’]);
$phone = strip_tags($_POST[‘phone’]);
$email = strip_tags($_POST[’email_required’]);
$username = strip_tags($_POST[‘username_required’]);
$password = strip_tags($_POST[‘password’]);
$passwordconfirmation = strip_tags($_POST[‘password2’]);
$memberid = ”;
$creditcardtype = strip_tags($_POST[‘credit_card’]);
$creditcardnumber = strip_tags($_POST[‘card_number’]);
$creditcardcsv = strip_tags($_POST[‘csv_required’]);
$creditcardexpiration = $_POST[‘expire_date’];
$billingnames = strip_tags($_POST[‘name_bill’]);
$billingcompanytheatre = strip_tags($_POST[‘company_bill’]);
$billingaddress1 = strip_tags($_POST[‘address_1_bill’]);
$billingaddress2 = strip_tags($_POST[‘address_2_bill’]);
$billingcity = strip_tags($_POST[‘city_bill’]);
$billingstate = strip_tags($_POST[‘state_bill’]);
$billingpostalcode = strip_tags($_POST[‘code_bill’]);
$billingcountry = strip_tags($_POST[‘country_bill’]);
if ($submit)
{
if ($firstname)
{
if ($lastname)
{
if ($address1)
{
if ($city)
{
if ($state)
{
if ($postalcode)
{
if ($country)
{
if ($phone)
{
if ($email)
{
if ($username)
{
if ($password)
{
if (strlen($password) > 5)
{
if ($passwordconfirmation)
{
if ($password == $passwordconfirmation)
{
if ($creditcardtype)
{
if ($creditcardnumber)
{
if ($creditcardexpiration)
{
if ($creditcardcsv)
{
if ($billingnames)
{
if ($billingaddress1)
{
if ($billingcity)
{
if ($billingstate)
{
if ($billingpostalcode)
{
if ($billingcountry)
{
$url = “http://www.tcg.org/auth/wp/register.cfc?method=InsertCustomerRecord&username_required=”.$username.”&password=”.urlencode($password).”&firstname=”.urlencode($firstname).”&lastname=”.urlencode($lastname).”&company=”.urlencode($company).”&subIndexID=”.$SubKey.”&GrandTotal=”.$Price.”&address_1=”.urlencode($address1).”&address_2=”.urlencode($address2).”&city=”.urlencode($city).”&state=”.urlencode($state).”&postalcode=”.$postalcode.”&country=”.urlencode($country).”&studentidgraduationyear=”.urlencode($studentidgraduationyear).”&phone=”.urlencode($phone).”&email_required=”.$email.”&memberid=”.$memberid.”&card_number=”.$creditcardnumber.”&credit_card=”.$creditcardtype.”&expire_date=”.$creditcardexpiration.”&csv_required=”.$creditcardcsv.”&name_bill=”.urlencode($billingname).”&company_bill=”.urlencode($billingcompanytheatre).”&address_1_bill=”.urlencode($billingaddress1).”&address_2_bill=”.urlencode($billingaddress2).”&city_bill=”.urlencode($billingcity).”&state_bill=”.urlencode($billingstate).”&code_bill=”.$billingpostalcode.”&country_bill=”.urlencode($billingcountry).”&returnformat=json”;
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
$xml = curl_exec($ch);
curl_close($ch);
$json = json_decode($xml);
$response = $json->DATA;
$arrcount = count($response, COUNT_RECURSIVE);
$arr_id = $response[0][0];
$arr_memberid = $response[0][1];
$arr_name = $response[0][2];
$arr_company = $response[0][3];
$arr_address1 = $response[0][5];
$arr_address2 = $response[0][6];
$arr_city = $response[0][7];
$arr_stateprovince = $response[0][8];
$arr_postalcode = $response[0][9];
$arr_country = $response[0][10];
$arr_phone = $response[0][11];
$arr_email = $response[0][12];
$arr_type = $response[0][16];
$arr_status = $response[0][18];
//echo var_dump($response).”
“;
//echo “Array Count: “.$arrcount.”
“;
//echo “URL: “.$url.”
“;
//echo “Array: “.$response[0][0].”
“;
//echo “Array: “.$response[0][1].”
“;
if ($arrcount >= 33)
{
$url = “http://www.tcg.org/auth/wp/validate.cfc?method=ValidateThis&UserNameRequired=”.$username.”&PasswordRequired=”.$password.”&returnformat=json”;
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
$xml = curl_exec($ch);
curl_close($ch);
$json=json_decode($xml);
$response = $json->DATA;
$arrcount = count($response, COUNT_RECURSIVE);
$username = $response[0][0];
$webid = $response[0][1];
$memberid = $response[0][2];
$parentmemberid = $response[0][3];
$status = $response[0][4];
$type = $response[0][5];
$membername = $response[0][6];
if ($arrcount == 8)
{
$_SESSION[‘username’] = $username;
$_SESSION[‘status’] = $status;
$_SESSION[‘type’] = $type;
$_SESSION[‘membername’] = $membername;
header (“Refresh:1; url=http://www.americantheatre.org/category/news/”);
echo “You have successfully registered – please check your email for your receipt. You are now being logged in automatically.”;
die();
}
else
{
header (“Refresh:3; url=http://www.americantheatre.org/log-in/”);
echo “Your have successfully registered – however we could not log you in automatically. You are now being redirected to the login page.”;
die();
}
}
else
{
if ($arrcount == 3)
{
if($response[0][1] == ‘Duplicate Account Found’){
echo “ALERT: There is a problem with your username and or password . Please enter a different username and password..”;
}
else{
echo “ALERT: There is a problem with your submission. Please contact customer service at custserve@tcg.org or 212.609.5900.”;
}
}
}
}
else
{
$billingcountry_error = “Please enter your billing address country“;
$ErrorExist = 1;
}
}
else
{
$billingpostalcode_error = “Please enter your billing address postal code“;
$ErrorExist = 1;
}
}
else
{
$billingstate_error = “Please enter your billing address state/province“;
$ErrorExist = 1;
}
}
else
{
$billingcity_error = “Please enter the city of your billing address“;
$ErrorExist = 1;
}
}
else
{
$billingaddress1_error = “Please enter your billing address“;
$ErrorExist = 1;
}
}
else
{
$billingname_error = “Please enter the name on your card“;
$ErrorExist = 1;
}
}
else
{
$csvnumber_error = “Please enter your credit card security number“;
$ErrorExist = 1;
}
}
else
{
$creditcardexpiration_error = “Please enter your credit card expiration date“;
$ErrorExist = 1;
}
}
else
{
$creditcardnumber_error = “Please enter your credit card number“;
$ErrorExist = 1;
}
}
else
{
$creditcardtype_error = “Please select a credit card type“;
$ErrorExist = 1;
}
}
else
{
$password_mismatch_error = “Your passwords do not match“;
$ErrorExist = 1;
}
}
else
{
$passwordconfirmation_error = “Please confirm your password“;
$ErrorExist = 1;
}
}
else
{
$password_constraint_error = “Your password must be at least 5 characters“;
$ErrorExist = 1;
}
}
else
{
$password_error = “Please enter your password“;
$ErrorExist = 1;
}
}
else
{
$username_error = “Please enter your username“;
$ErrorExist = 1;
}
}
else
{
$email_error = “Please enter your email address“;
$ErrorExist = 1;
}
}
else
{
$phone_error = “Please enter your phone number“;
$ErrorExist = 1;
}
}
else
{
$country_error = “Please enter your country“;
$ErrorExist = 1;
}
}
else
{
$postalcode_error = “Please enter your postal code“;
$ErrorExist = 1;
}
}
else
{
$state_error = “Please enter your state/province“;
$ErrorExist = 1;
}
}
else
{
$city_error = “Please enter your city“;
$ErrorExist = 1;
}
}
else
{
$address_error = “Please enter your address“;
$ErrorExist = 1;
}
}
else
{
$lastname_error = “Please enter your last name“;
$ErrorExist = 1;
}
}
else
{
$firstname_error = “Please enter your first name“;
$ErrorExist = 1;
}
}
if (isset($ErrorExist) && ($ErrorExist === 1)) {echo “ALERT: There is a problem with your form submission. Please check to make sure all required fields are entered..”;}
[/insert_php]Please complete the forms below and submit your subscription
Your subscription information |
|||||
---|---|---|---|---|---|
Publication | Type | # Issues | Qty | Price | Total |
|
[insert_php] echo $Desc_short; [/insert_php] |
[insert_php] echo $NumIssues; [/insert_php] issues | 1 | [insert_php] echo ‘$ ‘.$Price; [/insert_php] | [insert_php] echo ‘$ ‘.$Price; [/insert_php] |
Subscription Total: | [insert_php] echo ‘$ ‘.$Price; [/insert_php] |
BILLING INFORMATION. | ||
* Select Card Type:Visa MasterCardAmerican Express [insert_php] echo $creditcardtype_error; [/insert_php] | ||
* Credit Card Number | [insert_php] echo $creditcardnumber_error; [/insert_php] | |
* Expiration Date (mm/yy) | [insert_php] echo $creditcardexpiration_error; [/insert_php] | |
* CSV (Card Security Number) | [insert_php] echo $csvnumber_error; [/insert_php] | |
Billing Address | ||
* Name (first, last) | [insert_php] echo $billingname_error; [/insert_php] | |
Company/Theatre | ||
* Address | [insert_php] echo $billingaddress1_error; [/insert_php] | |
* City | [insert_php] echo $billingcity_error; [/insert_php] | |
* State or Province | [insert_php] echo $billingstate_error; [/insert_php] | |
* Postal Code | [insert_php] echo $billingpostalcode_error; [/insert_php] | |
* Country | [insert_php] echo $billingcountry_error; [/insert_php] | |