Sign up for our Stunning Newsletter

"; //echo "Yacht Choice = $yacht_choice
"; if (isset($_POST["checksubmit"]) && (eregi('^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$', $_POST["email"])) && $_POST['yacht_count'] == $yacht_choice) { /// *** CONSTANT CONTACT DATA *** /// //Constant Contact login $username = "boatbookings"; $password = "charter"; // Is this a subscribe or unsubscribe? if (isset($_POST["unsub_request"]) && $_POST["unsub_request"] == "1") $url = "https://api.constantcontact.com/0.1/API_UnsubscribeSiteVisitor.jsp"; else $url = "https://api.constantcontact.com/0.1/API_AddSiteVisitor.jsp"; // Constant form data $data = "loginName=" . $username; $data .= "&loginPassword=" . $password ; $data .= "&ea=" . urlencode(strip_tags($_POST["email"]));; if (isset($_POST["First_Name"])) $data .= "&First_Name=" . urlencode(strip_tags($_POST["First_Name"])); if (isset($_POST["Last_Name"])) $data .= "&Last_Name=" . urlencode(strip_tags($_POST["Last_Name"])); if (isset($_POST["Job_Title"])) $data .= "&Job_Title=" . urlencode(strip_tags($_POST["Job_Title"])); if (isset($_POST["Company_Name"])) $data .= "&Company_Name=" . urlencode(strip_tags($_POST["Company_Name"])); if (isset($_POST["Work_Phone"])) $data .= "&Work_Phone=" . urlencode(strip_tags($_POST["Work_Phone"])); if (isset($_POST["Home_Phone"])) $data .= "&Home_Phone=" . urlencode(strip_tags($_POST["Home_Phone"])); if (isset($_POST["Address_Line_1"])) $data .= "&Address_Line_1=" . urlencode(strip_tags($_POST["Address_Line_1"])); if (isset($_POST["Address_Line_2"])) $data .= "&Address_Line_2=" . urlencode(strip_tags($_POST["Address_Line_2"])); if (isset($_POST["City"])) $data .= "&City=" . urlencode(strip_tags($_POST["City"])); if (isset($_POST["State"])) $data .= "&State=" . urlencode(strip_tags($_POST["State"])); if (isset($_POST["Country"])) $data .= "&Country=" . urlencode(strip_tags($_POST["Country"])); if (isset($_POST["Postal_Code"])) $data .= "&Postal_Code=" . urlencode(strip_tags($_POST["Postal_Code"])); if (isset($_POST["Sub_Postal_Code"])) $data .= "&Sub_Postal_Code=" . urlencode(strip_tags($_POST["Sub_Postal_Code"])); if (isset($_POST["Email_Type"])) $data .= "&Email_Type=" . urlencode(strip_tags($_POST["Email_Type"])); // For each submitted list, we run through these actions. foreach($_POST["list_name"] as $list_name) { // Unique list for each loop iteration if ($list_name) $list_data = "&ic=" . urlencode(strip_tags($list_name)); //If the form was submitted, and the email is valid, then POST via libcurl $ch = curl_init(); // initialize curl handle curl_setopt($ch, CURLOPT_URL,$url); // set url to post to curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s curl_setopt($ch, CURLOPT_POST, 1); // set POST method curl_setopt($ch, CURLOPT_POSTFIELDS, $data . $list_data); // add POST fields $cc_result = curl_exec($ch); // run the whole process curl_close($ch); // Create an array of the response values $details = explode("\n",$cc_result); // NEED ERROR CHECKING CODE HERE } if (isset($_POST["unsub_request"]) && $_POST["unsub_request"] == "1") { if ($details[0] == "0"){ $default_path = $_SERVER['DOCUMENT_ROOT']; echo "

Success:

You've been removed.
"; } // NEED ERROR CHECKING CODE HERE else if ($details[0] == "500") echo "

Oops...

There was a problem removing you: " . $details[1]; } else { if (isset($_POST["First_Name"]) && $_POST["First_Name"] != "") $name_html = ", " . $_POST["First_Name"]; if ($details[0] == "0") echo "

Success:

Great! You've been signed up" . $name_html . ". We'll be in touch soon!"; else if ($details[0] == "500") echo "

Oops...

There was a problem signing up for at least one list. " . $details[1]; } } // Either the form was not sent yet, or the email was bad else { // If the form was sent, it means the email address was invalid if (isset($_POST["checksubmit"])) { echo "

Oops...

Something about that email address doesn't look quite right. Please make sure it contains the \"@\" sign and has \"dot something\" at the end. ALSO: Make sure you count the yachts correctly at the bottom of the page. Thank you."; } /// *** CUSTOMER DATA *** /// // Print the form, including original values if tried to process at least once before ?>

The StunningYachts.com Newsletter keeps up up to date on luxury yacht charter destinations, happenings, and deals. We focus on new charter areas, feature unique and newsworthy yachts, and search the world for the best deals to help you plan your next charter.

The newsletter is free, of course - just fill in the form below and we will be in touch!


First Name:
Last Name:
Email:
Email Type: > HTML > Text
   
* Human Verification: Please count the yachts and enter the number in the box provided
"; $boat_num = $boat_num +1; } echo "
Number of Yachts: "; ?>
"; } // Otherwise, if there are more than one list, we'll show them all else { foreach($list_array as $list_name) { $list_html .= " " . $list_name . "
"; } echo " Please choose which newsletters you'd like to receive. "; } ?>

 
 
Need to unsubscribe? Enter your email address below and click the button below
Email:  
  
 

$html_footer "; //include_once("$default_path/inqludes/footer.html"); ?>