Contact UsIf you have any feedback you'd like to relay to us or you're looking to get in touch with us for a link exchange please feel free to fill out the contact form below and we'll be sure to try and get back to you ASAP. define('TO_EMAIL', 'silo@protonmail.com'); define('TO_NAME', 'GammonEmpire.com'); define('EMAIL_FIELD_PATTERN','/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i'); define('OTHER_FIELD_PATTERN','/^[a-z0-9()\/\'":\*+|,.; \- !?$@]{2,100}$/i'); function sendMail($results) { $headers = "From: ".TO_NAME." <".TO_EMAIL.">\r\nMIME-Version: 1.0\r\nContent-type: text/plain; charset=iso-8859-1\r\n"; $body = "Name: ".$results['name']."\r\nEmail: ".$results['email']."\r\n\r\nComments:\r\n".$results['comments']; return mail(TO_EMAIL, TO_NAME.' Contact Form', $body, $headers); } function createMessages($messages) { $results = ''; if (count($messages['error']) > 0 || count($messages['info']) > 0) { foreach ($messages['error'] as $error) { $results .= "$error "; } foreach ($messages['info'] as $info) { $results .= "$info "; } } return $results; } $messages['error']=array(); $messages['info']=array(); $sent = false; /* The `lastName` and `submit` vars are spam-traps: they should not be present. */ if (isset($_POST['submitNotSpam']) && !isset($_POST['lastName']) && !isset($_POST['submit'])) { $results['name'] = trim(stripslashes($_POST['name'])); $results['email'] = trim(stripslashes($_POST['email'])); $results['comments'] = trim(stripslashes($_POST['comments'])); /* * Sanitize form input * http://www.nyphp.org/PHundamentals/8_Preventing-Email-Header-Injection */ if (!preg_match(OTHER_FIELD_PATTERN, $results['name'])) { $messages['error'][] = 'Please enter a valid Name.'; $results['name'] = ''; } if (!preg_match(EMAIL_FIELD_PATTERN, $results['email'])) { $messages['error'][] = 'Please enter a valid Email Address. '; $results['email'] = ''; } if (strlen($results['comments']) < 1 || strlen($results['comments']) > 8192) { $messages['error'][] = 'Please enter valid Comments. '; $results['comments'] = ''; } if (count($messages['error']) == 0) { if (sendMail($results)) { $messages['info'][] = 'Thank you for your email. Send another email'; $sent = true; } else { $messages['error'][] = 'Error sending email.'; } } } echo createMessages($messages); if (! $sent) { ?> } ?> |
|
Copyright © GammonEmpire.com - All Rights Reserved |