64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0 || substr_count($exploded_email[1],".") > 3){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $key => $value){if($key == 0){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}elseif(strlen($value) > 6 || !preg_match('/^[a-z0-9]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}} } // Remove leading whitespace from all values. function recursive_array_check(&$element_value) { if(!is_array($element_value)){$element_value = ltrim($element_value);} else { foreach($element_value as $key => $value){$element_value[$key] = recursive_array_check($value);} } return $element_value; } recursive_array_check($_REQUEST); // Check referrer is from same site. if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";} // Check for a blank form. function recursive_array_check_blank($element_value) { global $set; if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}} else { foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);} } } recursive_array_check_blank($_REQUEST); if(!$set){$errors[] = "You cannot send a blank form";} unset($set); // Display any errors and do not send mail if errors exist. if(count($errors)){ $page["title"] = "Donation and Sponsorship Requests"; $page["section"] = "about"; $page["header"] = "headerSub"; $page["content_filename"] = "donations"; $menu[$page["section"]] = "on"; include($path ."content/layout/". $page["header"] .".inc.php"); include($path ."content/". $page["section"] . "_" . $page["content_filename"] .".inc.php"); include($path ."content/layout/footer.inc.php"); exit; } if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");} // Build message. $cName = $_REQUEST['cName']; $cPurpose = $_REQUEST['cPurpose']; $cAddr = $_REQUEST['cAddr']; $cContact = $_REQUEST['cContact']; $cPhone = $_REQUEST['cPhone']; $cFax = $_REQUEST['cFax']; $cEmail = $_REQUEST['cEmail']; $fType = $_REQUEST['fType']; $fDate = $_REQUEST['fDate']; $fLoc = $_REQUEST['fLoc']; $fPeople = $_REQUEST['fPeople']; $fDemo = $_REQUEST['fDemo']; $fAds = $_REQUEST['fAds']; $dReq = $_REQUEST['dReq']; $dUse = $_REQUEST['dUse']; $dPromo = $_REQUEST['dPromo']; $message = " Donation Request from: ------------------------------------------ Charity Name: " . $cName . " Description: " . $cPurpose . " Contact Name: " . $cContact . " Address: " . $cAddr . " Email: " . $cEmail . " Phone: " . $cPhone . " Fax: " . $cFax . " Function Details: ------------------------------------------ Type of Function: " . $fType . " Function Date: " . $fDate . " Function Location: " . $fLoc . " Number of People Attending: " . $fPeople . " Function Demographics: " . $fDemo . " Advertising: " . $fAds . " Donation Request: ------------------------------------------ Donation Request: " . $dReq . " How will the donation be used?: " . $dUse . " Promotion of Red: " . $dPromo . ""; $message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL."Red Mountain Resort"; $message = stripslashes($message); $subject = "Donation Form Submission"; $from = $_REQUEST['cEmail']; $errors = NULL; mail2($dept,$subject,$message,$from); /*************************************** ********* EDIT THIS SECTION ********** ***************************************/ $page["title"] = "Donation and Sponsorship Requests"; $page["section"] = "about"; $page["header"] = "headerSub"; $page["content_filename"] = "donations_sent"; $menu[$page["section"]] = "on"; /*************************************** ********* DO NOT EDIT BELOW *********** ***************************************/ include($path ."content/layout/". $page["header"] .".inc.php"); include($path ."content/". $page["section"] . "_" . $page["content_filename"] .".inc.php"); include($path ."content/layout/footer.inc.php"); ?>