*************************************************************** */ require_once('for_professionals_contact_globals.php'); /* if( $useCaptcha ) { ob_start(); // Turn on output buffering, and save all output until we are ready @session_start(); // if we don't have a session, start one (@ = suppress errors) } */ if( $isDropInStore ) { $thisFile = $_SERVER['PHP_SELF']; $page_subtitle = "For Professionals - Get on our Mailing List"; } $showThankyou = false; $errorMessage = ""; $textBody = ""; $HTMLBody = ""; $replyName = ""; // LEAVE BLANK $replyAddy = ""; // LEAVE BLANK // Make shorter var names of our contents in the contact globals file // so that our long function calls are easier to read $toName = $contactForm_toName; $toAddy = $contactForm_toAddy; $fromName = $contactForm_fromName; $fromAddy = $contactForm_fromAddy; $mailSubject = $contactForm_subject; $sendHost = $email_sendHost; if ( isset($_POST['action']) && $_POST['action'] != '' ) { list($formAllowedToRun,$status,$errorCode) = formAllowedToRun($formTypeID); if ( ! $formAllowedToRun ) { $errorMessage = "There was an error sending your information. "; $errorMessage .= "[Error # $errorCode] Please try submitting it again. "; $errorMessage .= "We apologize for the inconvenience."; // Add $status to $errorMessage for debugging purposes only // as it contains info about IPs being added to block lists, etc. // Alternately, $status can be emailed to the site owner along // with some of $_POST if there are ever reports of legitimate // submissions being blocked. $showThankyou = false; } else { // Extract all variables foreach ( $_POST as $varname=>$value ) { $$varname = $value; } $errorFields = array(); // Set NULLS if ( ! isset($comments) ) { $comments = NULL; } if ( ! isset($first_name) ) { $first_name = NULL; } if ( ! isset($last_name) ) { $last_name = NULL; } if ( ! isset($title) ) { $title = NULL; } if ( ! isset($organization) ) { $organization = NULL; } if ( ! isset($address) ) { $address = NULL; } if ( ! isset($city) ) { $city = NULL; } if ( ! isset($state) ) { $state = NULL; } if ( ! isset($zip) ) { $zip = NULL; } if ( ! isset($country) ) { $country = NULL; } if ( ! isset($url) ) { $url = NULL; } if ( ! isset($phone) ) { $phone = NULL; } if ( ! isset($fax) ) { $fax = NULL; } if ( ! isset($email) ) { $email = NULL; } // Check our magic human-response field /* if ( $useCaptcha && ! empty($_POST['captcha_phrase']) && $_POST['captcha_phrase'] == $_SESSION['captcha_phrase']) { $weHaveAHuman = true; } else { $weHaveAHuman = false; $errorMessage .= "
$captchaError"; } */ // Comment-out any non-required fields if ( $comments == "" ) { $errorFields[] = 'Comments'; } if ( $first_name == "" ) { $errorFields[] = 'First Name'; } //if ( $last_name == "" ) { $errorFields[] = 'Last Name'; } //if ( $title == "" ) { $errorFields[] = 'Title'; } //if ( $organization == "" ) { $errorFields[] = 'Organization'; } //if ( $address == "" ) { $errorFields[] = 'Address'; } //if ( $city == "" ) { $errorFields[] = 'City'; } //if ( $state == "" ) { $errorFields[] = 'State'; } //if ( $zip == "" ) { $errorFields[] = 'Zip Code'; } //if ( $country == "" ) { $errorFields[] = 'Country'; } //if ( $url == "" ) { $errorFields[] = 'URL'; } //if ( $phone == "" ) { $errorFields[] = 'Phone'; } //if ( $email == "" ) { $errorFields[] = 'Email Address'; } if ( isset($errorFields) && $errorFields[0] != '' ) { $errorMessage = "Please fill in the following fields and resubmit your form:
"; $errorMessage .= implode(', ', $errorFields); } if ( $how_contact == 'email' && !isValidEmailAddress($email) ) { $errorMessage .= "
Please include a valid email address where we may contact you."; } if ( $how_contact == 'phone' && $phone == "" ) { $errorMessage .= "
Please include a phone number where we may contact you."; } if ( $how_contact == 'fax' && $fax == "" ) { $errorMessage .= "
Please include a fax number where we may contact you."; } if ( $how_contact == 'mail' && ( $last_name == "" || $address == "" || $city == "" || $state == "" || $zip == "" || $country == "" ) ) { $errorMessage .= "
Please include your full mailing address."; } // Check contents of POST, strip bad chars, then // later re-extract from new array list($naughtyNaughty,$sourceTrace,$cleanedPostData) = spamThwarter(); if ( $naughtyNaughty && ! $notifyAbuse ) { $errorMessage .= "
Invalid input found. Please re-check your submission and try again. We apologize for any inconvenience."; } if ( ! $allowOurDomain ) { $flagMe = false; // This needs to be a list of all web aliases foreach ( $ourDomains as $thisDomain ) { if ( emailMatchesOurDomain($email, $thisDomain) ) { $flagMe = true; } } if ( $flagMe ) { $errorMessage .= "
Invalid Email Address Domain."; } } if ( $errorMessage == "" ) { $showThankyou = true; } } } elseif ( ! isset($_POST['action']) ) { // First time in form. Initialize variables $errorMessage = NULL; $comments = NULL; $first_name = NULL; $last_name = NULL; $title = NULL; $organization = NULL; $address = NULL; $city = NULL; $state = NULL; $zip = NULL; $country = NULL; $url = NULL; $phone = NULL; $fax = NULL; $email = NULL; } if ( ! $showThankyou ) { /* if( $useCaptcha ) { // Generate an image and set a session var with // the text that was generated require_once('ContactForm/Captcha.php'); list($phrase,$captchaURL) = doCaptcha($captchaParams); $_SESSION['captcha_phrase'] = $phrase; } */ // Output our form if ( $useXipe ) { $bodyFile = "_template_for_professionals_contact.html"; $bodyOptions = array( "templateDir" => $templateMainDir, "compileDir" => $templateCompileDir, "autoBraces" => false); $bodyTemplate = new HTML_Template_Xipe($bodyOptions); $bodyTemplate->compile($bodyFile); if ( $isDropInStore ) { $useRightNav = false; include($template_pageLayout); } else { include($bodyTemplate->getCompiledTemplate()); } } else { $bodyFile = "_template_for_professionals_contact_noxipe.html"; include ($bodyFile); } } else { foreach ( $cleanedPostData as $varname=>$value ) { $$varname = $value; } // Email the comments $textBody = "\n\n-=-=-=-=-=-=-=- Automated Message -=-=-=-=-=-=-=-\n\n"; $textBody .= "Comments:\n $comments\n\n"; if ( $how_contact == 'phone' ) { $textBody .= "Followup Method: Phone\n\n"; } if ( $how_contact == 'fax' ) { $textBody .= "Followup Method: Fax\n\n"; } if ( $how_contact == 'email' ) { $textBody .= "Followup Method: Email\n\n"; } if ( $how_contact == 'mail' ) { $textBody .= "Followup Method: Postal Mail\n\n"; } if ( $how_contact == 'none' ) { $textBody .= "Followup Method: Don't Contact\n\n"; } $textBody .= "$first_name $last_name"; if ( $email != "" ) { $textBody .= " ($email)"; } $textBody .= "\n"; if ( $title != "" ) { $textBody .= "$title\n"; } if ( $organization != "" ) { $textBody .= "$organization\n"; } if ( $address != "" ) { $textBody .= "$address\n"; } if ( $city != "" || $state != "" || $zip != "" ) { $textBody .= "$city, $state $zip\n"; } if ( $country != "" ) { $textBody .= "$country\n\n"; } if ( $phone != "" ) { $textBody .= "$phone (Phone)\n"; } if ( $fax != "" ) { $textBody .= "$fax (Fax)\n"; } if ( $url != "" ) { $textBody .= "$url\n"; } $textBody .= "\n"; if ( $how_found != "" ) { $textBody .= "How Found Website:\n $how_found\n\n"; } $textBody .= "\n\n-=-=-=-=-=-=-=- Automated Message -=-=-=-=-=-=-=-\n\n"; $textBody .= $sourceTrace; if ( $email == "" ) { // Use default From: address } else { $fromAddy = $email; $replyAddy = $email; if ( $first_name != "" || $last_name != "" ) { $fromName = "$first_name $last_name"; $mailSubject = $mailSubject . " - $first_name $last_name"; } else { $fromName = $email; // if they have an email but no name, use email } } if ( $naughtyNaughty ) { $textBody = $abuseMessage . $textBody; } if ( $naughtyNaughty ) { // GOATS DETECTED! (POTENTIAL FORM ABUSE) if ( $useSMTPAuth ) { // Send to us the proper way $errorMessage .= sendAuthenticatedEmail($abuse_toName1, $abuse_toAddy1, $fromName, $fromAddy, $replyName, $replyAddy, $abuseSubject, $HTMLBody, $textBody, $sendHost, $smtpServer, $smtpUser, $smtpPass); $errorMessage .= sendAuthenticatedEmail($abuse_toName2, $abuse_toAddy2, $fromName, $fromAddy, $replyName, $replyAddy, $abuseSubject, $HTMLBody, $textBody, $sendHost, $smtpServer, $smtpUser, $smtpPass); } else { // Send to us using php / apache built-ins $errorMessage .= sendEmail("$abuse_toName1 <$abuse_toAddy1>", "$fromName <$fromAddy>", $abuseSubject, $textBody); $errorMessage .= sendEmail("$abuse_toName2 <$abuse_toAddy2>", "$fromName <$fromAddy>", $abuseSubject, $textBody); } } else { // Message okay if ( preg_match("/@/", $toAddy) ) { if ( $useSMTPAuth ) { $errorMessage .= sendAuthenticatedEmail($toName, $toAddy, $fromName, $fromAddy, $replyName, $replyAddy, $mailSubject, $HTMLBody, $textBody, $sendHost, $smtpServer, $smtpUser, $smtpPass); } else { $errorMessage .= sendEmail("$toName <$toAddy>", "$fromName <$fromAddy>", $mailSubject, $textBody); } } else { $errorMessage .= "INVALID 'TO:' ADDRESS: ($toAddy) -- MESSAGE NOT SENT
"; } if ( $hasCC ) { foreach ($ccFolks as $thisOne ) { $ccName = $thisOne['name']; $ccAddy = $thisOne['addy']; if ( preg_match("/@/", $ccAddy) ) { if ( $useSMTPAuth ) { $errorMessage .= sendAuthenticatedEmail($ccName, $ccAddy, $fromName, $fromAddy, $replyName, $replyAddy, $mailSubject, $HTMLBody, $textBody, $sendHost, $smtpServer, $smtpUser, $smtpPass); } else { $errorMessage .= sendEmail("$ccName <$ccAddy>", "$fromName <$fromAddy>", $mailSubject, $textBody); } } else { $errorMessage .= "INVALID 'CC:' ADDRESS: ($ccAddy) -- MESSAGE NOT SENT
"; } } } } // Show Thankyou Page if ( $useXipe ) { $bodyFile = "_template_for_professionals_contact_thanks.html"; $bodyOptions = array( "templateDir" => $templateMainDir, "compileDir" => $templateCompileDir, "autoBraces" => false); $bodyTemplate = new HTML_Template_Xipe($bodyOptions); $bodyTemplate->compile($bodyFile); if ( $isDropInStore ) { $useRightNav = false; include($template_pageLayout); } else { include($bodyTemplate->getCompiledTemplate()); } } else { $bodyFile = "_template_for_professionals_contact_thanks_noxipe.html"; include ($bodyFile); } } ?>