|
|
"yourname@yourdomain.com",
"Business Proposition" => "yourname@yourdomain.com",
"Request Consultation" => "yourname@yourdomain.com",
"Other" => "yourname@yourdomain.com"
);
//enter blocked ip addresses below separated by commas
$BlockedIP = "1.1.1.1";
//enter blocked email addresses below between the quotes
$BlockedEmail = "someone@aol.com, spammer@aol.com";
//Sonic Version
$sonic_ver = "1.0.1";
//1.0.1 added security and routing
function valid_email($email)
{
// Check for a valid email address.
$regexp = "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,6})$";
// Get the hostname.
$fromHost = explode("@", $_POST['email']);
// Test for both valid syntax and a valid server.
if ( !eregi($regexp, $_POST['email']) || !checkdnsrr($fromHost[1], "MX") ) {
return false;
}else{
return true;
}
}
if($_POST["step"] == "send"){
$send_email = "yes";
//lets try to make it no
//no name, you can't contact us without a name
if(!$_POST["name"]){
$send_email = "no";
$error_message_name = "Please enter your name below.";
}
//contact pref is phone but no phone number entered
if($_POST["contact_preference"] == "phone" && !$_POST["phone"]){
$send_email = "no";
$error_message_phone = "You chose phone as your contact preference, but
you did not enter your phone number. Please enter it now.";
}
if($_POST["rc"] != $_POST["rc2"]){
$send_email = "no";
$error_message_security = "Your security characters did not match ours.
Please try again. IP Address Logged As: $REMOTE_ADDR";
}
//check for valid email format
if (!valid_email($email)){
$send_email = "no";
$error_message_email = "Your email address appears invalid. Please
re-enter it below.";
}
//check for blocked ips
$sonicx = strstr($BlockedIP, getenv('REMOTE_ADDR'));
if($sonicx == TRUE){
$send_email = "no";
$error_message .= "Sorry but we could not process your form at this time.";
$error_type = "fatal";
}
$sonicxemail = @strstr($BlockedEmail, $_POST["email"]);
//echo "Post email =". $_POST["email"];
//echo "sonicxemail =". $sonicxemail;
if($sonicxemail == TRUE){
$send_email = "no";
$error_message .= "Sorry but we could not process your form at this time.";
$error_type = "fatal";
}
if (preg_match ("/".str_replace("www.", "", $_SERVER["SERVER_NAME"])."/i", $_SERVER["HTTP_REFERER"])
&& ($send_email == "yes")){
//start formatting and building the message
// handle post strings
reset($_POST);
while(list($key, $val) = each($_POST)) {
$GLOBALS[$key] = $val;
if (is_array($val)) {
$sonicMessage .= "$key: ";
foreach ($val as $vala) {
$vala =stripslashes($vala);
$vala = htmlspecialchars($vala);
$sonicMessage .= "$vala, ";
}
$sonicMessage .= " \n";
}else{
$val = stripslashes($val);
if (($key == "Submit") || ($key == "submit")){
}else{
if ($val == ""){
$sonicMessage .= "$key: - \n";
}else{
$sonicMessage .= "$key: $val \n";
}
}
}
} // end while
//determine the mail routing
foreach($SubjectArray as $key=>$val){
if($_POST["subject"] == $key){
$MailToAddress = $val;
} //end if
} //end foreach
$sonicMessage .= "
\n Sender IP: ".getenv('REMOTE_ADDR')." | | | |