$value) { if (is_array($value)) { $value = implode(",", $value); } $name = "$" . $key; $code = str_replace($name, $value, $code); } $code = str_replace('$ipaddress', $_SERVER['REMOTE_ADDR'], $code); return $code; } if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['formid']) && $_POST['formid'] == 'form1') { $mailto = 'staff@standrewsumc.org'; $mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto; $mailbcc = 'hebrews13.8@aol.com'; $subject = 'Website form'; $message = 'Values submitted from web site form:'; $success_url = './page1.html'; $error_url = './page2.html'; $eol = "\n"; $error = ''; $mail = new PHPMailer(true); try { $subject = ReplaceVariables($subject); $mail->Subject = stripslashes($subject); $mail->From = $mailfrom; $mail->FromName = $mailfrom; $mailto_array = explode(",", $mailto); $mailbcc_array = explode(",", $mailbcc); for ($i = 0; $i < count($mailto_array); $i++) { if(trim($mailto_array[$i]) != "") { $mail->AddAddress($mailto_array[$i], ""); } } for ($i = 0; $i < count($mailbcc_array); $i++) { if(trim($mailbcc_array[$i]) != "") { $mail->AddBCC($mailbcc_array[$i], ""); } } if (!ValidateEmail($mailfrom)) { $error .= "The specified email address (" . $mailfrom . ") is invalid!\n
"; throw new Exception($error); } $mail->AddReplyTo($mailfrom); $mail->CharSet = 'ISO-8859-1'; if (!empty($_FILES)) { foreach ($_FILES as $key => $value) { if ($_FILES[$key]['error'] == 0) { $mail->AddAttachment($_FILES[$key]['tmp_name'], $_FILES[$key]['name']); } } } $message = ReplaceVariables($message); $message = stripslashes($message); $mail->MsgHTML($message); $mail->IsHTML(true); $mail->Send(); header('Location: '.$success_url); } catch (Exception $e) { $errorcode = file_get_contents($error_url); $replace = "##error##"; $errorcode = str_replace($replace, $e->getMessage(), $errorcode); echo $errorcode; } exit; } if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['formid']) && $_POST['formid'] == 'form2') { $mailto = 'hebrews13.8@aol.com'; $mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto; $subject = 'Website form'; $message = 'Values submitted from web site form:'; $success_url = ''; $error_url = ''; $eol = "\n"; $error = ''; $internalfields = array ("submit", "reset", "send", "filesize", "formid", "captcha_code", "recaptcha_challenge_field", "recaptcha_response_field", "g-recaptcha-response"); $boundary = md5(uniqid(time())); $header = 'From: '.$mailfrom.$eol; $header .= 'Reply-To: '.$mailfrom.$eol; $header .= 'MIME-Version: 1.0'.$eol; $header .= 'Content-Type: multipart/mixed; boundary="'.$boundary.'"'.$eol; $header .= 'X-Mailer: PHP v'.phpversion().$eol; try { if (!ValidateEmail($mailfrom)) { $error .= "The specified email address (" . $mailfrom . ") is invalid!\n
"; throw new Exception($error); } $message .= $eol; $message .= "IP Address : "; $message .= $_SERVER['REMOTE_ADDR']; $message .= $eol; foreach ($_POST as $key => $value) { if (!in_array(strtolower($key), $internalfields)) { if (!is_array($value)) { $message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . $eol; } else { $message .= ucwords(str_replace("_", " ", $key)) . " : " . implode(",", $value) . $eol; } } } $body = 'This is a multi-part message in MIME format.'.$eol.$eol; $body .= '--'.$boundary.$eol; $body .= 'Content-Type: text/plain; charset=ISO-8859-1'.$eol; $body .= 'Content-Transfer-Encoding: 8bit'.$eol; $body .= $eol.stripslashes($message).$eol; if (!empty($_FILES)) { foreach ($_FILES as $key => $value) { if ($_FILES[$key]['error'] == 0) { $body .= '--'.$boundary.$eol; $body .= 'Content-Type: '.$_FILES[$key]['type'].'; name='.$_FILES[$key]['name'].$eol; $body .= 'Content-Transfer-Encoding: base64'.$eol; $body .= 'Content-Disposition: attachment; filename='.$_FILES[$key]['name'].$eol; $body .= $eol.chunk_split(base64_encode(file_get_contents($_FILES[$key]['tmp_name']))).$eol; } } } $body .= '--'.$boundary.'--'.$eol; if ($mailto != '') { mail($mailto, $subject, $body, $header); } header('Location: '.$success_url); } catch (Exception $e) { $errorcode = file_get_contents($error_url); $replace = "##error##"; $errorcode = str_replace($replace, $e->getMessage(), $errorcode); echo $errorcode; } exit; } ?> Visitor
If you are a member, please register your attendance wth us today.
Submit
St Andrews United Methodist Church
Submit
If you are a visitor, we are blessed that you joined us. Please let us know who you are.