function check_len(&$check, $field, $max, &$err_field, $err="", $min, $min_err="")
{
if (strlen($field) > $max)
{
if ($err == "")
{
$err = $msg->err_maxlen($max);
}
$err_field = $err;
if ($check==true) $check = false;
}
if (strlen($field) < $min)
{
if ($min_err == "")
{
$min_err = $msg->err_minlen($min);
}
$err_field = $min_err;
if ($check==true) $check = false;
}
}
function check_mail(&$check, $fld, &$error_field, $invalidchars="", $blanks="")
{
global $msg;
$expr = "^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z][a-z]+\$";
//echo "expr=" . $expr . " ";
if ((!$fld) || ($fld=="") || (!eregi($expr,$fld)))
{
if ($invalidchars > "")
{
$error_field = $invalidchars . " \n";
} else {
$error_field = "invalid characters \n";
}
if ($check==true) $check =false;
}
if (strrpos($fld,' ') > 0)
{
if ($blanks > "")
{
$error_field = $blanks . " \n";
} else {
$error_field = "blanks in e-mail \n";
}
if ($check==true) $check =false;
}
}
if (empty($HTTP_POST_VARS["name"])) $HTTP_POST_VARS["name"]="";
if (empty($err_name)) $err_name=" ";
if (empty($HTTP_POST_VARS["email"])) $HTTP_POST_VARS["email"]="";
if (empty($err_email)) $err_email=" ";
if (empty($HTTP_POST_VARS["address"])) $HTTP_POST_VARS["address"]="";
if (empty($err_name)) $err_address=" ";
if (empty($HTTP_POST_VARS["city"])) $HTTP_POST_VARS["city"]="";
if (empty($err_email)) $err_city=" ";
if (empty($HTTP_POST_VARS["state"])) $HTTP_POST_VARS["state"]="";
if (empty($err_email)) $err_state=" ";
if (empty($HTTP_POST_VARS["country"])) $HTTP_POST_VARS["country"]="";
if (empty($err_email)) $err_country=" ";
if (empty($HTTP_POST_VARS["zip"])) $HTTP_POST_VARS["zip"]="";
if (empty($err_email)) $err_zip=" ";
if (empty($HTTP_POST_VARS["phone"])) $HTTP_POST_VARS["phone"]="";
if (empty($err_email)) $err_phone=" ";
if (empty($HTTP_POST_VARS["fax"])) $HTTP_POST_VARS["fax"]="";
if (empty($err_email)) $err_fax=" ";
if (empty($HTTP_POST_VARS["comment"])) $HTTP_POST_VARS["comment"]="";
if (empty($err_comment)) $err_comment=" ";
if (empty($HTTP_POST_VARS["priority"])) $HTTP_POST_VARS["priority"]="Rush,Normal";
if (empty($err_priority)) $err_priority=" ";
if (empty($HTTP_POST_VARS["join_mailist"])) $HTTP_POST_VARS["join_mailist"]="yes,no";
if (empty($err_join_mailist)) $err_join_mailist=" ";
$checked = true;
if (isset($HTTP_POST_VARS["submit"]))
{
check_len($checked, $HTTP_POST_VARS["name"],80,$err_name,"Field too long! Maximum number of characters:80",1,"Field required! Minimum number of characters:1");
check_len($checked, $HTTP_POST_VARS["email"],80,$err_email,"Field too long! Maximum number of characters:80",1,"Field required! Minimum number of characters:1");
check_mail($checked, $HTTP_POST_VARS["email"], $err_email,"The e-mail contains invalid characters or is incomplete.", "The e-mail contains blanks.");
}
if ( empty($HTTP_POST_VARS["submit"]) or (!$checked) )
{
?>
}
if (isset($HTTP_POST_VARS["submit"]) and ($checked) ) {
$msg = "\n";
$msg .= "Name: ".$HTTP_POST_VARS["name"]."\n";
$msg .= "Email: ".$HTTP_POST_VARS["email"]."\n";
$msg .= "Address: ".$HTTP_POST_VARS["address"]."\n";
$msg .= "City: ".$HTTP_POST_VARS["city"]."\n";
$msg .= "State: ".$HTTP_POST_VARS["state"]."\n";
$msg .= "Country: ".$HTTP_POST_VARS["country"]."\n";
$msg .= "Zip Code: ".$HTTP_POST_VARS["zip"]."\n";
$msg .= "Phone: ".$HTTP_POST_VARS["phone"]."\n";
$msg .= "Fax: ".$HTTP_POST_VARS["fax"]."\n";
$msg .= "Comment: ".$HTTP_POST_VARS["comment"]."\n";
$msg .= "Priority: ".$HTTP_POST_VARS["priority"]."\n";
$msg .= "Join Mailing List: ".$HTTP_POST_VARS["join_mailist"]."\n";
mail("liz@domusonline.com","Request from the Domusonline.com Contact Us Form",
$msg);
echo "Your message has been sent to the Domus team. Thank you for your inquiry. \n";
echo nl2br($msg) . " \r";
}
?>
|