<?php
$GLOBALS['SEP_DISABLED'] = 1; ?>
<?PHP
// load viewer library
  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('/home1/artisul0/public_html/artistsofpalmbeachcounty/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
   list($board_of_director_positionsRecords, $board_of_director_positionsMetaData) = getRecords(array(
    'tableName'   => 'board_of_director_positions',
   ));
     $directorposition = array_filter(array_pluck($board_of_director_positionsRecords, 'position')); 
   list($accountsRecords, $accountsMetaData) = getRecords(array(
    'tableName'   => 'accounts',
'where' => "board_of_director_position_1_email  LIKE '%1%' OR  board_of_director_position_2_email  LIKE '%1%' OR board_of_director_position_3_email  LIKE '%1%' ", 
  ));
 
// load records
  list($board_of_directors_informationRecords, $board_of_directors_informationMetaData) = getRecords(array(
    'tableName'   => 'board_of_directors_information',
    'allowSearch' => '0',
    'limit'       => '1',
	
  ));
  $board_of_directors_informationRecord = @$board_of_directors_informationRecords[0]; // get first record
  // To Emails 
 ?>
<?php foreach ($directorposition as $positiona): ?>
<?php foreach ($accountsRecords as $record): ?>
<?php if ($record['board_of_director_position_1:label'] == $positiona || $record['board_of_director_position_2:label'] == $positiona || $record['board_of_director_position_3:label'] == $positiona): // is there a position selected  ?>
<?php $positionc = strtolower($positiona); // format the position ?>
<?PHP $positionc = preg_replace('/\s+/', '_', $positionc ); ?>
<?PHP $positionc = preg_replace('/-/', '_', $positionc ); ?>
<?php if ($record['board_of_director_position_1:label'] == $positiona && $positiona && $record['board_of_director_position_1_email'] == '1'): // is this records email address the one to use  ?>
<?php $positionb = $record['email']?>
<?php endif ?>
<?php if ($record['board_of_director_position_2:label'] == $positiona && $positiona && $record['board_of_director_position_2_email'] == '1'): ?>
<?php  $positionb = $record['email']?>
<?php endif ?>
<?php if ($record['board_of_director_position_3:label'] == $positiona && $positiona && $record['board_of_director_position_3_email'] == '1'): ?>
<?php $positionb = $record['email']?>
<?php endif ?>
<?php  '$'; ?><?php $positionc ?><?php '='; ?><?php  $positionb ; ?><?php  ';' ; // // This is the code that is supposed to create the variables ?>
<?php endif ?>
<?php endforeach ?>
<?php endforeach ?>
<?php
define('kOptional', true);
define('kMandatory', false);

define('kStringRangeFrom', 1);
define('kStringRangeTo', 2);
define('kStringRangeBetween', 3);
        
define('kYes', 'yes');
define('kNo', 'no');




error_reporting(E_ERROR | E_WARNING | E_PARSE);
ini_set('track_errors', true);

function CaptchaGenerator() {

 if ( (!function_exists('imagejpeg')) && (!function_exists('imagepng')) ) {
  exit;
 }

 $im = imagecreate(100,40);

 $white = imagecolorallocate($im, 255, 255, 255);
 $black = imagecolorallocate($im, 0, 0, 0);
 $gray = imagecolorallocate($im, 150, 150, 150);

 imagerectangle($im, 0, 0, 25, 39, $gray);
 imagerectangle($im, 25, 0, 50, 39, $gray);
 imagerectangle($im, 50, 0, 75, 39, $gray);
 imagerectangle($im, 75, 0, 99, 39, $gray);

 imageline($im, 0, 0, 25, 39, $gray);
 imageline($im, 25, 0, 50, 39, $gray);
 imageline($im, 50, 0, 75, 39, $gray);
 imageline($im, 75, 0, 99, 39, $gray);

 imageline($im, 0, 39, 25, 0, $gray);
 imageline($im, 25, 39, 50, 0, $gray);
 imageline($im, 50, 39, 75, 0, $gray);
 imageline($im, 75, 39, 99, 0, $gray);

 $c1 = rand(65, 90);
 $c2 = rand(65, 90);
 $c3 = rand(65, 90);
 $c4 = rand(65, 90);
 $c5 = rand(65, 90);

 $textOut = chr($c1) . ' ' . chr($c2) . ' ' . chr($c3) . ' ' . chr($c4) . ' ' . chr($c5);
 $textCaptcha = chr($c1) . chr($c2) . chr($c3) . chr($c4) . chr($c5);

 $a = imagestring($im, 5, 11, 13, $textOut, $black);

 $fileName = substr(md5($textCaptcha), 0, 12);

 $captchaDir = 'verify';

 if ( !is_dir( $captchaDir ) ) {
  echo '<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><title>Error</title></head><body>Access Code Validation Error: directory &quot;verify&quot; not found. Script will quit now.</body></html>';
  exit;
 }

 if ( !is_writable( $captchaDir ) ) {
  echo '<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><title>Error</title></head><body>Access Code Validation Error: directory &quot;verify&quot; is not writeable. Script will quit now.</body></html>';
  exit;
 }

 $handle = opendir( $captchaDir );

 while ( $captchaFile = readdir($handle) ) {
  if ( ( substr($captchaFile, 0, 1) != '.' ) && ( substr($captchaFile, 0, 1) != '_' ) && ( !is_dir( 'verify' . '/' . $captchaFile ) ) ) {
   if ( ( filemtime( 'verify' . '/' . $captchaFile ) + 900 ) < time() ) {
    unlink( 'verify' . '/' . $captchaFile );
   }
  }
 }

 closedir( $handle );

 $handle = @fopen( 'verify' . '/' . $fileName, 'w' );

 if ( !$handle ) {
  echo '<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><title>Error</title></head><body>Access Code Validation Error: unable to create captcha control file. Script will quit now.</body></html>';
  exit;
 }
 
 fclose($handle);

 if (imagetypes() & IMG_JPG) {
  header('Content-type: image/jpeg');
  imagejpeg($im);
 } elseif (imagetypes() & IMG_PNG) {
  header('Content-type: image/png');
  imagepng($im);
 }
 exit;

}

function DoStripSlashes($fieldValue)  { 
// temporary fix for PHP6 compatibility - magic quotes deprecated in PHP6
 if ( function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc() ) { 
  if (is_array($fieldValue) ) { 
   return array_map('DoStripSlashes', $fieldValue); 
  } else { 
   return trim(stripslashes($fieldValue)); 
  } 
 } else { 
  return $fieldValue; 
 } 
}

function FilterCChars($theString) {
 return preg_replace('/[\x00-\x1F]/', '', $theString);
}

function ProcessTextField(&$codeHtmlForm, $fieldName, $fieldValue) {

 $tagPattern = '/(<input[^>]+name=[\'\"]?\Q' . $fieldName . '\E[\'\"\s]+[^>]*>)/i';
 preg_match($tagPattern, $codeHtmlForm, $matches);

 $htmlTag = $matches[1];
 $valuePattern = '/value=[\'\"]?[^\'\"]*[\'\"]+/i';
 $replacementPattern = 'value="' . $fieldValue . '" ';
 
 if (preg_match($valuePattern, $htmlTag)) {
  $htmlTagToReplace = preg_replace($valuePattern, $replacementPattern, $htmlTag);
 } else {
  $valuePattern = '/([^>\/]*)([\/]?>)/';
  $replacementPattern = '\1 value="' . $fieldValue . '" \2';
  $htmlTagToReplace = preg_replace($valuePattern, $replacementPattern, $htmlTag);
 }

 $codeHtmlForm = preg_replace($tagPattern, $htmlTagToReplace, $codeHtmlForm);

}

function ProcessTextArea(&$codeHtmlForm, $fieldName, $fieldValue) {

 $tagPattern = '/(<textarea[^>]+name=[\'\"]?\Q' . $fieldName . '\E[\'\"\s]+[^>]*)>(.*?)(<\/textarea>)/is';
 $replacementPattern = '\1>' . $fieldValue . '\3';

 $codeHtmlForm = preg_replace($tagPattern, $replacementPattern, $codeHtmlForm);

}

function ProcessSelect(&$codeHtmlForm, $fieldName, $fieldValues) {

 # Search the select tag
 $selectPattern = '/(<select[^>]+name=[\'\"]?\Q' . $fieldName . '\E(\[\]|)[\'\"\s]+[^>]*>.*?<\/select>)/is';
 $numMatches = preg_match($selectPattern, $codeHtmlForm, $selectMatches);
 
 $originalSelectTag = $selectMatches[1];
 
 # Remove the selected option tags
 $selectedPattern = '/(<option[^>]+)([\s]+selected="selected"|[\s]+selected)([^>]*)>/i';
 $replacementPattern = '\1\3>';
 $modifiedSelectTag = preg_replace($selectedPattern, $replacementPattern, $originalSelectTag);

 # Find the tags that must be checked 
 if (!is_array($fieldValues)) {
  if (strlen($fieldValues) > 0) {
   $fieldValues = array($fieldValues);
  } else {
   return;
  }
 }

 foreach ($fieldValues as $fieldValue) {
  # Find the options that must be selected
  $optionPattern = '/(<option[^>]+value=[\'\"]?\Q' . $fieldValue . '\E[\'\"\s]+[^>]*)(>)/i';
  $replacementPattern = '\1 selected="selected"\2';
  $modifiedSelectTag = preg_replace($optionPattern, $replacementPattern, $modifiedSelectTag);
 }
 
 # Replace the code in the form
 $codeHtmlForm = preg_replace($selectPattern, $modifiedSelectTag, $codeHtmlForm);

}


function ProcessPHPFile($PHPFile) {
 
 ob_start();
 
 if (file_exists($PHPFile)) {
  require $PHPFile;
 } else {
  echo '<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><title>Error</title></head><body>Forms To Go - Error: Unable to load HTML form: ' . $PHPFile . '</body></html>';
  exit;
 }
 
 return ob_get_clean();
}

function CheckString($value, $low, $high, $mode, $limitAlpha, $limitNumbers, $limitEmptySpaces, $limitExtraChars, $optional) {

 $regEx = '';

 if ($limitAlpha == kYes) {
  $regExp = 'A-Za-z';
 }
 
 if ($limitNumbers == kYes) {
  $regExp .= '0-9'; 
 }
 
 if ($limitEmptySpaces == kYes) {
  $regExp .= ' '; 
 }

 if (strlen($limitExtraChars) > 0) {
 
  $search = array('\\', '[', ']', '-', '$', '.', '*', '(', ')', '?', '+', '^', '{', '}', '|', '/');
  $replace = array('\\\\', '\[', '\]', '\-', '\$', '\.', '\*', '\(', '\)', '\?', '\+', '\^', '\{', '\}', '\|', '\/');

  $regExp .= str_replace($search, $replace, $limitExtraChars);

 }

 if ( (strlen($regExp) > 0) && (strlen($value) > 0) ){
  if (preg_match('/[^' . $regExp . ']/', $value)) {
   return false;
  }
 }

 if ( (strlen($value) == 0) && ($optional === kOptional) ) {
  return true;
 } elseif ( (strlen($value) >= $low) && ($mode == kStringRangeFrom) ) {
  return true;
 } elseif ( (strlen($value) <= $high) && ($mode == kStringRangeTo) ) {
  return true;
 } elseif ( (strlen($value) >= $low) && (strlen($value) <= $high) && ($mode == kStringRangeBetween) ) {
  return true;
 } else {
  return false;
 }

}


function CheckEmail($email, $optional) {
 if ( (strlen($email) == 0) && ($optional === kOptional) ) {
  return true;
  } elseif ( preg_match("/^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i", $email) == 1 ) {
  return true;
 } else {
  return false;
 }
}


function CheckEqualTo($original, $repeated) {
 if ($original == $repeated) {
  return true;
 } else {
  return false;
 }
}


function CheckFTGCaptcha($accessCode) {

 $captchaDir = 'verify';

 if ( !is_dir( $captchaDir ) ) {
  echo '<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><title>Error</title></head><body>Access Code Validation Error: directory &quot;verify&quot; not found. Script will quit now.</body></html>';
  exit;
 }

 $handle = opendir( $captchaDir );

 $fileAccessCode = substr( md5( $accessCode ), 0, 12 );

 while ( $captchaFile = readdir( $handle ) ) {
  if ( substr( $captchaFile, 0, 1 ) != '.' ) {
   if ( $fileAccessCode == $captchaFile ) {
    return true;
   }
  }
 }
 return false;
}

function DeleteCaptcha($accessCode) {

 $captchaDir = 'verify';

 if ( !is_dir( $captchaDir ) ) {
  echo '<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><title>Error</title></head><body>Access Code Validation Error: directory &quot;verify&quot; not found. Script will quit now.</body></html>';
  exit;
 }

 $handle = opendir( $captchaDir );

 $fileAccessCode = substr( md5( $accessCode ), 0, 12 );

 while ( $captchaFile = readdir( $handle ) ) {
  if ( ( substr( $captchaFile, 0, 1 ) != '.' ) && ( substr( $captchaFile, 0, 1 ) != '_' ) && ( !is_dir( 'verify' . '/' . $captchaFile ) ) ) {
   if ( $fileAccessCode == $captchaFile ) {
    unlink( 'verify' . '/' . $captchaFile );
    return;
   }
  }
 }

}



if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
 $clientIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
 $clientIP = $_SERVER['REMOTE_ADDR'];
}

if ( isset($_GET['formstogoimgflt']) ) {
 CaptchaGenerator();
 exit;
}

$FTGreason = DoStripSlashes( $_POST['reason'] );
$FTGfirst_name = DoStripSlashes( $_POST['first_name'] );
$FTGlast_name = DoStripSlashes( $_POST['last_name'] );
$FTGemail = DoStripSlashes( $_POST['email'] );
$FTGemail2 = DoStripSlashes( $_POST['email2'] );
$FTGmessage = DoStripSlashes( $_POST['message'] );
$FTGverify = DoStripSlashes( $_POST['verify'] );



$validationFailed = false;

# Fields Validations


if (!CheckString($FTGreason, 1, 0, kStringRangeFrom, kNo, kNo, kNo, '', kMandatory)) {
 $FTGErrorMessage['reason'] = 'Tell us why you\'re contacting us so we can route your message correctly.';
 $validationFailed = true;
}

if (!CheckString($FTGfirst_name, 1, 36, kStringRangeBetween, kNo, kNo, kNo, '', kMandatory)) {
 $FTGErrorMessage['first_name'] = 'Please enter your First Name';
 $validationFailed = true;
}

if (!CheckString($FTGlast_name, 1, 36, kStringRangeBetween, kNo, kNo, kNo, '', kMandatory)) {
 $FTGErrorMessage['last_name'] = 'Please enter your Last Name';
 $validationFailed = true;
}

if (!CheckEmail($FTGemail, kMandatory)) {
 $FTGErrorMessage['email'] = 'You\'ll need to enter your e-mail address before you can send this.';
 $validationFailed = true;
}

if (!CheckEqualTo($FTGemail2, $FTGemail)) {
 $FTGErrorMessage['email2'] = 'Your E-mail addresses don\'t match.';
 $validationFailed = true;
}

if (!CheckFTGCaptcha($FTGverify)) {
 $FTGErrorMessage['verify'] = 'Your input didn\'t match the (CASE SENSITIVE) characters displayed, please try again.';
 $validationFailed = true;
}



# Display HTML form with filled values

if ($validationFailed === true) {

 $fileHtmlForm = 'http://www.artistsofpalmbeachcounty.org/BODcontact3.php';
 
 $codeHtmlForm = file_get_contents($fileHtmlForm);


 ProcessSelect($codeHtmlForm, 'reason', $FTGreason);
 ProcessTextField($codeHtmlForm, 'first_name', $FTGfirst_name);
 ProcessTextField($codeHtmlForm, 'last_name', $FTGlast_name);
 ProcessTextField($codeHtmlForm, 'email', $FTGemail);
 ProcessTextField($codeHtmlForm, 'email2', $FTGemail2);
 ProcessTextArea($codeHtmlForm, 'message', $FTGmessage);


 $errorList = @implode("<br />\n", $FTGErrorMessage);
 $codeHtmlForm = str_replace('<!--VALIDATIONERROR-->', $errorList, $codeHtmlForm);

 $codeHtmlForm = str_replace('<!--FIELDVALUE:reason-->', $FTGreason, $codeHtmlForm);
 $codeHtmlForm = str_replace('<!--FIELDVALUE:first_name-->', $FTGfirst_name, $codeHtmlForm);
 $codeHtmlForm = str_replace('<!--FIELDVALUE:last_name-->', $FTGlast_name, $codeHtmlForm);
 $codeHtmlForm = str_replace('<!--FIELDVALUE:email-->', $FTGemail, $codeHtmlForm);
 $codeHtmlForm = str_replace('<!--FIELDVALUE:email2-->', $FTGemail2, $codeHtmlForm);
 $codeHtmlForm = str_replace('<!--FIELDVALUE:message-->', $FTGmessage, $codeHtmlForm);
 $codeHtmlForm = str_replace('<!--FIELDVALUE:verify-->', $FTGverify, $codeHtmlForm);
 $codeHtmlForm = str_replace('<!--ERRORMSG:reason-->', $FTGErrorMessage['reason'], $codeHtmlForm);
 $codeHtmlForm = str_replace('<!--ERRORMSG:first_name-->', $FTGErrorMessage['first_name'], $codeHtmlForm);
 $codeHtmlForm = str_replace('<!--ERRORMSG:last_name-->', $FTGErrorMessage['last_name'], $codeHtmlForm);
 $codeHtmlForm = str_replace('<!--ERRORMSG:email-->', $FTGErrorMessage['email'], $codeHtmlForm);
 $codeHtmlForm = str_replace('<!--ERRORMSG:email2-->', $FTGErrorMessage['email2'], $codeHtmlForm);
 $codeHtmlForm = str_replace('<!--ERRORMSG:verify-->', $FTGErrorMessage['verify'], $codeHtmlForm);



 echo $codeHtmlForm;

}

if ( $validationFailed === false ) {

 # Email to Form Owner
  
 $emailSubject = FilterCChars("$FTGreason");
  
 $emailBody = "You've received a message submitted via the\n"
  . "Artists of Palm Beach County Help Desk\n"
  . "\n"
  . "The person submitting this information is: $FTGfirst_name $FTGlast_name\n"
  . "\n"
  . "The message was sent from: $FTGemail\n"
  . "\n"
  . "\n"
  . "Here's what it said:\n"
  . "$FTGmessage\n"
  . "\n"
  . "This message was sent from IP address: $clientIP on " . date('m/d/y') . " at " . date('h:i:s A') . "\n"
  . "\n"
  . "";
  
 if ($FTGreason == "President") {
  
  $emailTo = $president;
   
  $emailFrom = FilterCChars("$FTGemail");
   
  $emailHeader = "From: $emailFrom\n"
  . "Bcc: $president_bcc_email\n"
   . "MIME-Version: 1.0\n"
   . "Content-type: text/plain; charset=\"UTF-8\"\n"
   . "Content-transfer-encoding: 8bit\n";
   
  mail($emailTo, $emailSubject, $emailBody, $emailHeader);
  
 }
 if ($FTGreason == "Vice-President") {
  
  $emailTo = $vice_president;
   
  $emailFrom = FilterCChars("$FTGemail");
   
  $emailHeader = "From: $emailFrom\n"
    . "Bcc: $vice_president_bcc_email\n"
	. "MIME-Version: 1.0\n"
   . "Content-type: text/plain; charset=\"UTF-8\"\n"
   . "Content-transfer-encoding: 8bit\n";
   
  mail($emailTo, $emailSubject, $emailBody, $emailHeader);
  
 }
 if ($FTGreason == "Secretary") {
  
  $emailTo = $secretary;
   
  $emailFrom = FilterCChars("$FTGemail");
   
  $emailHeader = "From: $emailFrom\n"
    . "Bcc: $secretary_bcc_email\n"
   . "MIME-Version: 1.0\n"
   . "Content-type: text/plain; charset=\"UTF-8\"\n"
   . "Content-transfer-encoding: 8bit\n";
   
  mail($emailTo, $emailSubject, $emailBody, $emailHeader);
  
 }
 if ($FTGreason == "Treasurer") {
  
  $emailTo = $treasurer;
   
  $emailFrom = FilterCChars("$FTGemail");
   
  $emailHeader = "From: $emailFrom\n"
   . "Bcc: $treasurer_bcc_email\n"
   . "MIME-Version: 1.0\n"
   . "Content-type: text/plain; charset=\"UTF-8\"\n"
   . "Content-transfer-encoding: 8bit\n";
   
  mail($emailTo, $emailSubject, $emailBody, $emailHeader);
  
 }
 if ($FTGreason == "Communications and Marketing Committee") {
  
  $emailTo = $communications_and_marketing_committee ;
   
  $emailFrom = FilterCChars("$FTGemail");
   
  $emailHeader = "From: $emailFrom\n"
    . "Bcc: $communications_and_marketing_committee_bcc_email\n"
	. "MIME-Version: 1.0\n"
   . "Content-type: text/plain; charset=\"UTF-8\"\n"
   . "Content-transfer-encoding: 8bit\n";
   
  mail($emailTo, $emailSubject, $emailBody, $emailHeader);
  
 }
 if ($FTGreason == "Development Committee") {
  
  $emailTo = $development_committee;
   
  $emailFrom = FilterCChars("$FTGemail");
   
  $emailHeader = "From: $emailFrom\n"
    . "Bcc: $development_committee_bcc_email\n"
   . "MIME-Version: 1.0\n"
   . "Content-type: text/plain; charset=\"UTF-8\"\n"
   . "Content-transfer-encoding: 8bit\n";
   
  mail($emailTo, $emailSubject, $emailBody, $emailHeader);
  
 }
 if ($FTGreason == "Benefits and Services Committee") {
  
  $emailTo = $benefits_and_services_committee ;
   
  $emailFrom = FilterCChars("$FTGemail");
   
  $emailHeader = "From: $emailFrom\n"
   . "Bcc: $benefits_and_services_committee_bcc_email\n"
   . "MIME-Version: 1.0\n"
   . "Content-type: text/plain; charset=\"UTF-8\"\n"
   . "Content-transfer-encoding: 8bit\n";
   
  mail($emailTo, $emailSubject, $emailBody, $emailHeader);
  
 }
 if ($FTGreason == "Gallery Management Committee") {
  
  $emailTo = $gallery_management_committee ;
   
  $emailFrom = FilterCChars("$FTGemail");
   
  $emailHeader = "From: $emailFrom\n"
   . "Bcc: $gallery_management_committee_bcc_email\n"
   . "MIME-Version: 1.0\n"
   . "Content-type: text/plain; charset=\"UTF-8\"\n"
   . "Content-transfer-encoding: 8bit\n";
   
  mail($emailTo, $emailSubject, $emailBody, $emailHeader);
  
 }
 if ($FTGreason == "Membership Committee") {
  
  $emailTo = $membership_committee ;
   
  $emailFrom = FilterCChars("$FTGemail");
   
  $emailHeader = "From: $emailFrom\n"
   . "Bcc: $membership_committee_bcc_email\n"
   . "MIME-Version: 1.0\n"
   . "Content-type: text/plain; charset=\"UTF-8\"\n"
   . "Content-transfer-encoding: 8bit\n";
   
  mail($emailTo, $emailSubject, $emailBody, $emailHeader);
  
 }

 if ($FTGreason == "Structure and Governance Committee") {
  
  $emailTo = $structure_and_governance_committee;
   
  $emailFrom = FilterCChars("$FTGemail");
   
  $emailHeader = "From: $emailFrom\n"
   . "Bcc: $structure_and_governance_committee_bcc_email\n"
   . "MIME-Version: 1.0\n"
   . "Content-type: text/plain; charset=\"UTF-8\"\n"
   . "Content-transfer-encoding: 8bit\n";
   
  mail($emailTo, $emailSubject, $emailBody, $emailHeader);
  
 }  
 # Confirmation Email to User
  
 $confEmailTo = FilterCChars($FTGemail);
  
 $confEmailSubject = FilterCChars("Your Message To The Artists of Palm Beach County");
  
 $confEmailBody = chunk_split( base64_encode( "Hello $FTGfirst_name $FTGlast_name,\n"
  . "\n"
  . "Thanks for caring enough to contact us.\n"
  . "\n"
  . "You sent a message to the $FTGreason\n"
  . "\n"
  . "You sent your message from: FTGemail\n"
  . "\n"
  . "Here is what it said:\n"
  . "$FTGmessage\n"
  . "\n"
  . "They've received your message and will get back to you shortly.\n"
  . "\n"
  . "Best,\n"
  . "\n"
  . "Artists of Palm Beach County\n"
  . "\n"
  . "" ) );
  
 $confEmailHeader = "From: no-reply@artistsofpalmbeachcounty.org\n"
  . "MIME-Version: 1.0\n"
  . "Content-type: text/plain; charset=\"UTF-8\"\n"
  . "Content-transfer-encoding: base64\n";
  
 mail($confEmailTo, $confEmailSubject, $confEmailBody, $confEmailHeader);
  


DeleteCaptcha($FTGverify);

# Redirect user to success page

header("Location: http://www.artistsofpalmbeachcounty.org/contactsuccess.php");

}

?>