/*
########################## Contact Form 1.4 #########################
### |-----------------------------------------------------------| ###
### | WRITTEN 2006 by planetluc.com c/o Lukas Stalder | ###
### | THIS SMALL SCRIPT IS FREE AND MAY BE REDISTRIBUTED | ###
### |-----------------------------------------------------------| ###
#####################################################################
*/
/*
// ################ INSTALLATION #################
1. open the .php file where you want to have the contact form in.
2. paste this whole code in there
3. adapt values in the config section below to your needs.
4. upload the file - that's it!
// ############## END INSTALLATION ###############
*/
// ################### CONFIG ###################
error_reporting(0);
// CSS classes & styles
$classError = "error"; // class for error messages below input fields
$classTxt = "text"; // class for field caption cell
$classField = "field"; // class for input/textarea field cell
$classInputbutton = "inputButton"; // class for submit button
$classInputline = "inputLine"; // class for input lines
$classInputfield = "inputField"; // class for textareas
$styleInputline = "width:300px;"; // add. styles for input lines
$styleInputfield = "width:300px; height:100px;"; // add. styles for textareas
$styleInputbutton = "width:300px;"; // add. styles for submit button
$styleInputradio = "vertical-align:middle;"; // add. styles for radio input fields
$styleInputselect = "width:50px;";
// email
$targetAddress = "wgf@muenster.org,joachim.hetscher@gmx.de";
$emailSubject = "Kartenbestellung WGF";
// misc text
$txtSend = "Abschicken";
$txtMandatory = "obligatorisch";
$msgDate = "Datum";
$dateFormat = "d. M Y, H:i";
$txtRemainingChars = "Verbleibende Zeichen:";
// indent for field values in email message
$msgIndent = 15;
// errors (above/below the field)
$posError = "above";
//thank you messages
$txtThankyou = "Danke für Ihre Bestellung. Wir werden Sie bald kontaktieren.";
// form fields
/*
every form field is an array consisting of 6 elements:
1) field caption
2) field name
3) field type: line, field, radio, select, checkbox, multiselect, divider
4) additional info: if field type is
- 'radio' this field contains the radio captions/values like so: {caption1|value1} {caption2|value2} {caption3|value3}...
- 'select' this field contains the radio captions/values like so: {caption1|value1} {caption2|value2} {caption3|value3}...
- 'email' the field value must be a valid emailaddress
- 'checkbox' this field contains the radio captions/values like so: {caption1|value1} {caption2|value2} {caption3|value3}...
- 'multiselect' this field contains the radio captions/values like so: {caption1|value1} {caption2|value2} {caption3|value3}...
- 'divider' -> you can specify something like '' in the caption field
- 'field' this values optional defines a max chars number
5) mandatory ('*') or not ('')
6) error message if empty on submit and set to mandatory previously
*/
$fields[] = array("28. - 31.10.
Woody Guthrie Festival-Karte
Eintritt in alle Veranstaltungen
VVK: 20 € ×", "Woody_Guthrie_Festival-Karte", "select", "{0|0} {1|1} {2|2} {3|3} {4|4} {5|5}", "", "");
$fields[] = array("", "", "divider", "", "", "");
$fields[] = array("Do., 28.10., 20 Uhr
Strom und Wasser
Anarcho-Folk-Punk
Bennohaus / VVK: 8 € - AK: 10 € ×", "DO_Strom_und_Wasser", "select", "{0|0} {1|1} {2|2} {3|3} {4|4} {5|5}", "", "");
$fields[] = array("", "", "divider", "", "", "");
$fields[] = array("Fr., 29.10., 20 Uhr
"Die Zärtlichkeit der Völker" mit:
Pól McAdaim (Belfast): Songs
Duo Contraviento (Münster):
Hommage an Mercedes Sosa
und weiteren Künstlern
Bennohaus / VVK: 10 € - AK: 12 € ×", "FR_Zaertlichkeit_der_Voelker", "select", "{0|0} {1|1} {2|2} {3|3} {4|4} {5|5}", "", "");
$fields[] = array("", "", "divider", "", "", "");
$fields[] = array("Sa., 30.10., 20 Uhr
"Liederleute"
Stiff La Wolf (Schönwolde)
Bernd Köhler (Hamburg) mit Jan Lindqvist
Bennohaus / VVK: 10 € - AK: 12 € ×", "SAM_Liederleute", "select", "{0|0} {1|1} {2|2} {3|3} {4|4} {5|5}", "", "");
$fields[] = array("", "", "divider", "", "", "");
$fields[] = array("So., 31.10., 19 Uhr
"Wie sollt ich da nicht singen?"
Chor Die Untertanen (Münster)
Chor Chorrosion (Bochum)
Bennohaus / VVK: 10 € - AK 12 € ×", "SO_Choere", "select", "{0|0} {1|1} {2|2} {3|3} {4|4} {5|5}", "", "");
$fields[] = array("", "", "divider", "", "", "");
$fields[] = array("Name", "Name", "line", "", "*", "Bitte geben Sie Ihren Namen an");
$fields[] = array("Vorname", "Vorname", "line", "", "*", "Bitte geben Sie Ihren Vorname an");
$fields[] = array("Straße", "Straße", "line", "", "*", "Bitte geben Sie Ihre Straße an");
$fields[] = array("Hausnummer", "Hausnummer", "line", "", "*", "Bitte geben Sie Ihre Hausnummer an");
$fields[] = array("PLZ", "PLZ", "line", "", "*", "Bitte geben Sie Ihre Postleitzahl an");
$fields[] = array("Ort", "Ort", "line", "", "*", "Bitte geben Sie Ihren Ort an");
$fields[] = array("Telefonnummer", "Telefonnummer", "line", "", "*", "Bitte geben Sie Ihre Telefonnumer an");
$fields[] = array("Email-Adresse", "Email-Adresse", "line", "email", "*", "Bitte geben Sie Ihre Email-Adresse an");
$fields[] = array("Möchten Sie uns noch etwas mitteilen?", "Möchten_Sie_uns_noch_etwas_mitteilen?", "field", "", "", "");
// ################ END CONFIG ##########################################################
// #######################################################################################
$version = "1.5";
$errorPointer = ($posError == "above") ? "↓ " : "↑ ";
function spaces($num, $fill=" "){
$foo="";
for ($i=0; $i<$num; $i++) $foo.=$fill;
return $foo;
}
function isValidEmail($addr){
if(eregi("^[a-z0-9]+([_.-][a-z0-9]+)*@([a-z0-9]+([.-][a-z0-9]+)*)+\\.[a-z]{2,4}$", $addr))
return true;
else
return false;
}
function jsCharCount(){
if ($GLOBALS['cfCharCountFunc'] != 1){
$html = "\n";
$GLOBALS['cfCharCountFunc'] = 1;
return $html;
}
}
// start form evaluation
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:".spaces($msgIndent-strlen($msgDate)).date($dateFormat);
foreach ($fields as $field){
if ($field[2] == "divider"){
$message .= "\n-----------------------------------";
}else{
$message .= "\n".$field[0].":".spaces($msgIndent-strlen($field[0]));
if ($field[3] == "email"){
$message .= "mailto:".$_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 .= " ";
}
mail($targetAddress, $emailSubject, $message, $fromAddress);
//echo "
$message
";
echo $txtThankyou;
}
}
if ($error!==false){
$html = "";
// draw form
$html .= "\n\n \n\n";
$html .= "\n";
$html .= "\n \n\n";
echo $html;
}
/*
######################### END Contact Form ##########################
#####################################################################
*/
?>
(Die Karten werden nicht automatisch zugestellt; wir kontaktieren Sie persönlich. Daher brauchen wir diese Daten von Ihnen, die nach dem 31. Oktober gelöscht werden.)
include "inc/part2.inc"; ?>