GLAMPINGCARD
Bestellen Sie Sofort kostenlos Ihre GlampingCard
// ################### CONFIG ###################
error_reporting(0);
// CSS
$classError = "error";
$classTxt = "text";
$classField = "field";
$classInputbutton = "inputButton";
$classInputline = "inputLine";
$classInputfield = "inputField";
$styleInputline = "width:550px;";
$styleInputfield = "width:550px; height:60px;";
$styleInputbutton = "width:754px; background-color: #000; color: #fff; border: none; font-weight: bold; height: 24px; line-height: 24px; ";
$styleInputradio = "vertical-align:middle;";
$styleInputselect = "width:300px; clear: both;";
// E-mail studio@interdijk.nl
$targetAddress = "bestel@interdijk.nl";
$emailSubject = "Bestelling GlampingCard";
// Teksten
$txtSend = "zum versenden";
$txtMandatory = "Verpflichtend";
$msgDate = "Datum";
$dateFormat = "d-m-Y, H:i";
$txtRemainingChars = "Aantal woorden: hele pagina 150 woorden, halve pagina 80 woorden, kwart pagina 40 woorden ";
// INDENT
$msgIndent = 15;
// ERRORS (above/below)
$posError = "below";
//BEDANKT TEKST
$txtThankyou = "";
//UW GEGEVENS ("Naam Invulveld", "variabele invulveld", "soort", "Options", "required", "Melding die zichtbaar is indien required");
//soort = line - chackbox - radio - field
//options kan zijn bij radio {ja|ja}{nee|nee} / of bij chackbox{Zee|zee}{Rivier|rivier}{Meer|meer}{Bos|bos}{Bergen|bergen}{Landelijk|landelijk}
//required = * voor required
$fields[] = array("Name", "naam", "line", "", "", "");
$fields[] = array("Adresse", "adres", "line", "", "", "");
$fields[] = array("Residentz", "plaats", "line", "", "", "");
$fields[] = array("Postleitzahl", "postcode", "line", "", "", "");
$fields[] = array("Land", "land", "line", "", "", "");
$fields[] = array("E-mail", "email", "line", "email", "*", "Bitte geben Sie eine gültige E-Mail-Adresse.");
// ################ EINDE CONFIG ##########################################################
// #######################################################################################
$errorPointer = ($posError == "above") ? "↓ " : "↑ ";
function spaces($num, $fill=" "){
$foo="";
for ($i=0; $i<$num; $i++) $foo.=$fill;
return $foo;
}
function isValidEmail($addr){
if(preg_match("(^[-\w\.]+@([-a-z0-9]+\.)+[a-z]{2,4}$)i", $addr))
return true;
else
return false;
}
function jsCharCount(){
if ($GLOBALS['cfCharCountFunc'] != 1){
$html = "\n";
$GLOBALS['cfCharCountFunc'] = 1;
return $html;
}
}
// STRAT EVALUATIE
unset($error);
if ($_REQUEST['do']=="send"){
$error = false;
$fromAddress = "";
$message = "";
foreach ($fields as $field){
if ($field[4] == "*"){
if ($field[3] == "email"){
if (!isValidEmail($_REQUEST[$field[1]])) $error[$field[1]] = $field[5];
}else{
if ($_REQUEST[$field[1]] == "" || $_REQUEST[$field[1]] == " " || $_REQUEST[$field[1]] == " ") $error[$field[1]] = $field[5];
}
}
}
if ($error === false){
$message = $emailSubject." \n
"; for ($i = 0; $i < strlen($emailSubject); $i++) $message .= "*"; $message .= " \n\n
$msgDate:"." ".date($dateFormat)."\n\n
"; foreach ($fields as $field){ if ($field[2] == "leegveld"){ $message .= "\n"; }else if ($field[2] == "kopje"){ $message .= "\n".$field[0]; }else{ $message .= "\n".$field[0].":"." "; if ($field[3] == "email"){ $message .= "".$_REQUEST[$field[1]]."
"; $fromAddress = "From: ".$_REQUEST[$field[1]]; }else if ($field[2] == "checkbox" || $field[2] == "multiselect"){ $multi = ""; foreach ($_REQUEST[$field[1]] as $val){ $divider = ($multi != "") ? ", " : ""; $multi .= (isset($val) && $val != "") ? $divider.$val : ""; } $message .= "".$multi."
"; }else $message .= "".$_REQUEST[$field[1]]."
"; } $message .= ""; } $headers = $fromAddress . "\r\n"; $headers .= "Reply-To: ". $_REQUEST[$field[1]] . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=UTF-8\r\n"; mail($targetAddress, $emailSubject, $message, $headers); //echo "
Dankt
Das Formular wird in einem guten Zustand erhalten."; for ($i = 0; $i < strlen($emailSubject); $i++) $message .= "*"; $message .= " \n\n
$msgDate:"." ".date($dateFormat)."\n\n
"; foreach ($fields as $field){ if ($field[2] == "leegveld"){ $message .= "\n"; }else if ($field[2] == "kopje"){ $message .= "\n".$field[0]; }else{ $message .= "\n".$field[0].":"." "; if ($field[3] == "email"){ $message .= "".$_REQUEST[$field[1]]."
"; $fromAddress = "From: ".$_REQUEST[$field[1]]; }else if ($field[2] == "checkbox" || $field[2] == "multiselect"){ $multi = ""; foreach ($_REQUEST[$field[1]] as $val){ $divider = ($multi != "") ? ", " : ""; $multi .= (isset($val) && $val != "") ? $divider.$val : ""; } $message .= "".$multi."
"; }else $message .= "".$_REQUEST[$field[1]]."
"; } $message .= ""; } $headers = $fromAddress . "\r\n"; $headers .= "Reply-To: ". $_REQUEST[$field[1]] . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=UTF-8\r\n"; mail($targetAddress, $emailSubject, $message, $headers); //echo "
$message"; echo $txtThankyou; } } if ($error!==false){ $html = ""; // FORMULIER UITTEKENEN $html .= "