'', 'email' => '', 'message' => '', 'captcha' => '', ); $contactDetails = '

Contact Details

The Studio,
Church Steps,
Woodbury,
Devon,
EX5 1HW
Tel: '.PHONE_NUMBER.'
'; if(isset($_POST['contactSubmit'])) { $data = checkData($_POST); if(isset($data['error'])) { require_once HEADER_FILE; ?>

Ooops!

I found some possible mistakes with the information you provided. Please check the messages below and adjust your information accordingly

* '.$msg.'
'; } echo '

'; echo contactForm(contactEscape($data)); require_once FOOTER_FILE; } else { sendAdminMessage($data); if(sendCustomerMessage($data)) { } $title = 'Thank You for Your Message'; require_once HEADER_FILE; ?>

Thank You for Your Message

Your message has been sent to Kimberly and you can expect a reply in due course.
Thanks!

Contact...

Please use the form below to send me a message.

COMPANY_NAME.' <'.MAIN_EMAIL.'>', 'To' => COMPANY_NAME.' <'.MAIN_EMAIL.'>', 'Reply-To' => $data['name'].' <'.$data['email'].'>', 'Subject' => ADMIN_SUBJECT, ); $mime = new Mail_mime(CRLF); $mime->setHTMLBody(getAdminHTMLBody($data)); //$mime->setTXTBody(getTXTBody($data)); $body = $mime->get(); $hdrs = $mime->headers($headers); $mail =& Mail::factory('smtp',array( 'host'=>SMTP_HOST, 'auth'=>SMTP_AUTH, 'username'=>SMTP_USER, 'password'=>SMTP_PASS, 'port'=>SMTP_PORT, 'localhost'=>'localhost',) ); return $mail->send(MAIN_EMAIL,$hdrs,$body); } function getAdminHTMLBody($data=array()) { $body = file_get_contents(ADMIN_EMAIL_TMPL); $body = str_replace('{#NAME#}',htmlentities($data['name']),$body); $body = str_replace('{#EMAIL#}',htmlentities($data['email']),$body); $body = str_replace('{#MESSAGE#}',nl2br(htmlentities($data['message'])),$body); $body = str_replace('{#DATE#}',date("l jS F Y, H:i"),$body); $body = str_replace('{#REMOTE_INFO#}', 'IP Address: '.$_SERVER['REMOTE_ADDR'].'
Host Name: '.gethostbyaddr($_SERVER['REMOTE_ADDR']).'
User Agent: '.$_SERVER['HTTP_USER_AGENT'],$body); return $body; } function sendCustomerMessage($data = array()) { $headers = array( 'To' => $data['name'].' <'.$data['email'].'>', 'From' => COMPANY_NAME.' <'.MAIN_EMAIL.'>', 'Reply-To' => COMPANY_NAME.' <'.MAIN_EMAIL.'>', 'Subject' => CUSTOMER_SUBJECT, ); $mime = new Mail_mime(CRLF); $mime->setHTMLBody(getHTMLBody($data)); $mime->setTXTBody(getTXTBody($data)); $body = $mime->get(); $hdrs = $mime->headers($headers); $mail =& Mail::factory('smtp',array( 'host'=>SMTP_HOST, 'auth'=>SMTP_AUTH, 'username'=>SMTP_USER, 'password'=>SMTP_PASS, 'port'=>SMTP_PORT, 'localhost'=>'localhost',) ); return $mail->send($data['email'],$hdrs,$body); } function getHTMLBody($data = array()) { $body = file_get_contents(HTML_EMAIL_TMPL); $body = str_replace('{#NAME#}',$data['name'],$body); return $body; } function getTXTBody($data = array()) { $body = file_get_contents(TEXT_EMAIL_TMPL); $body = str_replace('{#NAME#}',$data['name'],$body); return $body; } /** * Escape submitted data for re-display */ function contactEscape($data = array()) { foreach($data as $k => $v) { if($k !== 'error') { $data[$k] = htmlentities($v, ENT_QUOTES); } } return $data; } /** * Validate Submitted Data */ function checkData($data=array()) { if(empty($data['name'])) { $data['error'][] = 'Please provide your name'; } elseif (!preg_match('/^[a-z0-9\. '.preg_quote('\'"?,!','/').'-]+$/i',$data['name'])) { $data['error'][] = 'Invalid characters were detected in your name. Please only type in alphanumeric characters and punctation'; } $data['email'] = trim(strtolower($data['email'])); if(empty($data['email'])) { $data['error'][] = 'Please provide your email address'; } elseif(!preg_match("/^([\w\-\.]+)@((\[([0-9]{1,3}\.){3}[0-9]{1,3}\])|(([\w\-]+\.)+)([a-zA-Z]{2,4}))$/",$data['email'])) { $data['error'][] = 'Your email address appears to be incorrect. Please check your spelling'; } $data['message'] = trim($data['message']); if(empty($data['message'])) { $data['error'][] = 'Please provide a message.'; } $data['captcha'] = trim($data['captcha']); if(empty($data['captcha'])) { $data['error'][] = 'Please enter the security code'; } elseif($data['captcha'] != Captcha::getCurrentCode()) { $data['error'][] = 'The Security Code entered was incorrect. Please try again'; } if(isset($data['error'])) { $data['captcha'] = ''; } return $data; } /** * Display The Contact Form */ function contactForm($data=array()) { $form = '
'.Form::label('name','Your Name').':'.Form::inputText('name',$data['name'],array('size'=>30,'maxlength'=>30)).'
'.Form::label('email','Your Email Address').':'.Form::inputText('email',$data['email'],array('size'=>30,'maxlength'=>100)).'
'.Form::label('message','Your Message').':'.Form::inputTextArea('message',$data['message'],array('rows'=>10,'cols'=>27)).'

Please type the characters you can see below in red into the “Security Code” field. We\'re sorry for the inconvenience but it helps us to fight spam.

 Security Code
'.Form::label('captcha','Security Code').':'.Form::inputText('captcha',$data['captcha'],array('size'=>30,'maxlength'=>100)).'
 '.Form::inputSubmit('contactSubmit','Send Message').'
'; return $form; }