setExpectedHostname($expected_hostname)->verify($gRecaptchaResponse, $remoteIp); $recaptcha_verification_success = $recaptcha_verification->isSuccess(); } // deal with posting if($_SERVER["REQUEST_METHOD"] == "POST" && $recaptcha_verification_success == true) { $formarray = General::parse_input($_POST); $name = General::fixtext($formarray["name"]); $phone = General::fixtext($formarray["phone"]); $email = General::fixtext($formarray["email"]); $subject = General::fixtext($formarray["subject"]); $message = General::fixtext($formarray["message"],"textarea"); $errors = array(); if ($name == "") $errors[] = array("message"=>"Name is required.", "highlight"=>"name"); if (!General::is_email_valid($email)) $errors[] = array("message"=>"Email is required and must be valid.", "highlight"=>"email"); if ($subject == "") $errors[] = array("message"=>"Subject is required.", "highlight"=>"subject"); if ($message == "") $errors[] = array("message"=>"Message is required.", "highlight"=>"message"); if (count($errors)>0) { $onload_js = " onLoad='show_error();'"; foreach($errors as $some_error) { $highlight_js .= " document.getElementById('".$some_error["highlight"]."').style.border='2px solid red';"; $alert .= $some_error["message"]."\\n"; } $error_js .= " "; } else { // ok, so send email $email_message = "A Visitor to The Family Matrix web site just filled out the contact form: Name: $name Phone: $phone Email: $email Subject: $subject Message: $message"; $email_message = General::fixtext($email_message,"email"); $headers = 'From: Order desk ' . "\r\n"; $additional_params = "-forderdesk@familymatrix.com"; mail("contact_us@familymatrix.com","FamilyMatrix Contact Form Submission",$email_message, $headers, $additional_params); $form_submitted = true; // send response if thye filled in email - we know the email is valid if it isn't blank if ($email != "") { $headers = 'From: Order desk ' . "\r\n"; $additional_params = "-forderdesk@familymatrix.com"; mail($email, "Auto Response from Family Matrix","Thanks for contacting Family Matrix. We will address the issue immediately.", $headers, $additional_params); } } } else { $formarray = array(); } // begin page echo $page->build_start("Contact Us"); ?> build_body($onload_js); echo $page->build_head(); ?> Contact Us Please feel free to contact us with any concern. Thanks for your interest in Family Matrix products. Name: "> Email: "> Phone: "> (optional) Subject: "> Message: Thank you for contacting us. You will hear from us shortly. draw_flair(); echo $page->end_body(""); ?>