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["anrede"])) $HTTP_POST_VARS["anrede"]="Herr,Frau,Dr.,Prof.";
if (empty($err_anrede)) $err_anrede=" ";
if (empty($HTTP_POST_VARS["vorname"])) $HTTP_POST_VARS["vorname"]="";
if (empty($err_vorname)) $err_vorname=" ";
if (empty($HTTP_POST_VARS["nachname"])) $HTTP_POST_VARS["nachname"]="";
if (empty($err_nachname)) $err_nachname=" ";
if (empty($HTTP_POST_VARS["strasse"])) $HTTP_POST_VARS["strasse"]="";
if (empty($err_strasse)) $err_strasse=" ";
if (empty($HTTP_POST_VARS["plz"])) $HTTP_POST_VARS["plz"]="";
if (empty($err_plz)) $err_plz=" ";
if (empty($HTTP_POST_VARS["ort"])) $HTTP_POST_VARS["ort"]="";
if (empty($err_ort)) $err_ort=" ";
if (empty($HTTP_POST_VARS["telefon"])) $HTTP_POST_VARS["telefon"]="";
if (empty($err_telefon)) $err_telefon=" ";
if (empty($HTTP_POST_VARS["fax"])) $HTTP_POST_VARS["fax"]="";
if (empty($err_fax)) $err_fax=" ";
if (empty($HTTP_POST_VARS["email"])) $HTTP_POST_VARS["email"]="";
if (empty($err_email)) $err_email=" ";
if (empty($HTTP_POST_VARS["nachricht"])) $HTTP_POST_VARS["nachricht"]="";
if (empty($err_nachricht)) $err_nachricht=" ";
if (empty($HTTP_POST_VARS["kontakt"])) $HTTP_POST_VARS["kontakt"]="Brief,Fax,Telefon,E-Mail";
if (empty($err_kontakt)) $err_kontakt=" ";
if (empty($HTTP_POST_VARS["firma"])) $HTTP_POST_VARS["firma"]="";
if (empty($err_firma)) $err_firma=" ";
if (empty($err_web)) $err_web=" ";
$checked = true;
if (isset($HTTP_POST_VARS["submit"]))
{
check_len($checked, $HTTP_POST_VARS["anrede"],10,$err_anrede,"Entry to long! Max.lengthens :10",0,"Input necessarily! Min. lengthens:1");
check_len($checked, $HTTP_POST_VARS["vorname"],80,$err_vorname,"Entry to long! Max.lengthens:80",0,"Input necessarily! Min. lengthens:1");
check_len($checked, $HTTP_POST_VARS["nachname"],80,$err_nachname,"Entry to long! Max.lengthens:80",0,"Input necessarily! Min. lengthens:1");
check_len($checked, $HTTP_POST_VARS["strasse"],80,$err_strasse,"Entry to long! Max.lengthens:80",0,"Input necessarily! Min. lengthens:1");
check_len($checked, $HTTP_POST_VARS["plz"],8,$err_plz,"Entry to long! Max.lengthens:8",0,"Input necessarily! Min. lengthens:1");
check_len($checked, $HTTP_POST_VARS["ort"],80,$err_ort,"Entry to long! Max.lengthens:80",0,"Input necessarily! Min. lengthens:1");
check_len($checked, $HTTP_POST_VARS["telefon"],80,$err_telefon,"Entry to long! Max.lengthens:80",0,"Input necessarily! Min. lengthens:1");
check_len($checked, $HTTP_POST_VARS["fax"],80,$err_fax,"Entry to long! Max.lengthens:80",0,"Input necessarily! Min. lengthens:1");
check_len($checked, $HTTP_POST_VARS["email"],80,$err_email,"Entry to long! Max.lengthens:80",0,"Input necessarily! Min. lengthens:1");
check_mail($checked, $HTTP_POST_VARS["email"], $err_email,"Thise e-Mail contains invalid charakters or is not complete.", "This e-Mail contains spaces.");
check_len($checked, $HTTP_POST_VARS["nachricht"],5000,$err_nachricht,"Entry to long! Max. lengthens:5000",0,"Input necessarily! Min. lengthens:1");
check_len($checked, $HTTP_POST_VARS["kontakt"],80,$err_kontakt,"Entry to long! Max. lengthens:80",0,"Input necessarily! Min. lengthens:1");
check_len($checked, $HTTP_POST_VARS["firma"],80, $err_firma,"Entry to long! Max. lengthens:80",0,"Input necessarily! Min. lengthens:1");
check_len($checked, $HTTP_POST_VARS["web"],80, $err_web,"Entry to long! Max. lengthens:80",0,"Input necessarily! Min. lengthens:1");
}
if ( empty($HTTP_POST_VARS["submit"]) or (!$checked) )
{
?>
}
if (isset($HTTP_POST_VARS["submit"]) and ($checked) ) {
$msg = "Contact data : \n \n";
$msg .= "Addresses=".$HTTP_POST_VARS["anrede"]."\n";
$msg .= "Company=".$HTTP_POST_VARS["firma"]."\n";
$msg .= "First Name=".$HTTP_POST_VARS["vorname"]."\n";
$msg .= "Last Name=".$HTTP_POST_VARS["nachname"]."\n";
$msg .= "Street=".$HTTP_POST_VARS["strasse"]."\n";
$msg .= "Zip Code=".$HTTP_POST_VARS["plz"]."\n";
$msg .= "City=".$HTTP_POST_VARS["ort"]."\n";
$msg .= "Telephone=".$HTTP_POST_VARS["telefon"]."\n";
$msg .= "Fax=".$HTTP_POST_VARS["fax"]."\n";
$msg .= "Email=".$HTTP_POST_VARS["email"]."\n";
$msg .= "Website=".$HTTP_POST_VARS["web"]."\n";
$msg .= "Message to RMCON=".$HTTP_POST_VARS["nachricht"]."\n";
$msg .= "Contact Desire 1=".$HTTP_POST_VARS["kontakt_1"]."\n";
$msg .= "Contact Desire 2=".$HTTP_POST_VARS["kontakt_2"]."\n";
$msg .= "Contact Desire 3=".$HTTP_POST_VARS["kontakt_3"]."\n";
$msg .= "Contact Desire 4=".$HTTP_POST_VARS["kontakt_4"]."\n";
mail("kontakt@rmcon.de","Request via rmcon Website",
$msg);
echo "Your request was send to RMCON
\n";
echo nl2br($msg) . "
\n";
}
?>