";
if (!preg_match("(^[-\w\.]+@([-a-z0-9]+\.)+[a-z]{2,4}$)i",$inputArray['email'])) $errors .= "Email address is not valid
";
if (!empty($inputArray[phone])) if (!preg_match("(^[-0-9\(\)\.]{7,}$)i",$inputArray[phone])) $errors .= "Phone number is not valid
";
if (!preg_match("([\w]+)",$inputArray['content'])) $errors .= "Your message is empty
";
// max messages
if (empty($errors)) $_SESSION['msgCount']++;
if ($_SESSION['msgCount'] >= "4") $errors .= "Messages have exceeded the maximum number allowed";
// stop if errors
if (!empty($errors)) { return "Your message was not sent
".$errors; }
// remove any input array variables not to be included in output email
unset($inputArray['send']);
// scrub variables
foreach ($inputArray as $key=>$value) {
$inputArray[$key] = trim($inputArray[$key]);
$inputArray[$key] = stripslashes($inputArray[$key]);
$inputArray[$key] = htmlspecialchars($inputArray[$key],ENT_QUOTES);
$inputArray[$key] = wordwrap($inputArray[$key],65,"
");
}
// need to use the config parms in this routine
global $subject,$emailaddress,$fromaddress,$thankyouPage;
// set headers
if (empty($fromaddress)) $fromaddress = $inputArray['email'];
$headers = 'MIME-Version: 1.0'."\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n";
$headers .= "From: website<".$fromaddress.">\r\n";
// format message
$message = "
| $key | $value |
|