$_REQUEST['zahlungsweise'] = $_REQUEST['zahlungsweise'] or $_REQUEST['zahlungsweise'] = "vorkasse";
if ($_REQUEST['func'] == "send")
{
$error = array();
$checkArray = array("name",1,"vorname",1,"email",6);
$error = checkFormData($_REQUEST, $checkArray);
if (count($error) == 0)
{
if ($_REQUEST[b1])
{$bestellung .= "$_REQUEST[b1] = $_REQUEST[az1] Stück\n";}
if ($_REQUEST[b2])
{$bestellung .= "$_REQUEST[b2] = $_REQUEST[az2] Stück\n";}
if ($_REQUEST[b3])
{$bestellung .= "$_REQUEST[b3] = $_REQUEST[az3] Stück\n";}
if ($_REQUEST[b4])
{$bestellung .= "$_REQUEST[b4] = $_REQUEST[az4] Stück\n";}
if ($_REQUEST[b5])
{$bestellung .= "$_REQUEST[b5] = $_REQUEST[az5] Stück\n";}
// Formular versenden
$mail = "
Name: $_REQUEST[name]
Vorname: $_REQUEST[vorname]
Strasse Nr: $_REQUEST[strasse] $_REQUEST[hausnummer]
PLZ : $_REQUEST[plz]
Stadt: $_REQUEST[stadt]
Email: $_REQUEST[email]
Geburtstag: $_REQUEST[geburtsdatum]
Bestellung:
$bestellung
Zahlungsweise: $_REQUEST[zahlungsweise]
" ;
/* mail("ok@kemweb.de", "Bestellung / Anfrage www.makeyourstory.de", $mail,
"From: ".$_REQUEST['email']."\r\n"
."Reply-To: ".$_REQUEST['email']."\r\n"
."");
*/
mail("mentzel@cmuk.de", "Bestellung / Anfrage www.makeyourstory.de", $mail,
"From: ".$_REQUEST['email']."\r\n"
."Reply-To: ".$_REQUEST['email']."\r\n"
."");
header("Location: danke.php");
}
else
{
$msg = "
Bitte alle hervorgehobenen Felder ausfüllen!
";
}
}
function checkFormData($formData,$check)
{
$error = array();
$optional = "";
for ($j=0;$j < count($check);$j=$j+2)
{
$checkAction = $check[$j+1];
$key = $check[$j];
$val = $formData[$key];
# echo "
$checkAction -- $key:$val";
// Wenn Checkaktion am Schluss ein Stern * enthält ist die Angabe Optional
if (preg_match("/([^\*]*)\*$/i",$checkAction,$matches))
{
$checkAction = $matches[1]; // Wert ohne "*"
$optional = " Oder Feld freilassen.";
if ($val == "")
{
$checkAction = 0;
}
#echo "
$checkAction -- $key:$val";
}
switch ($checkAction)
{
case "0":
// Wert ist optional
break;
case "1":
if ($val == "")
{
$error[$key] = "Bitte ausfüllen.".$optional;
}
break;
case "2":
if (!preg_match("/^[0-9]+$/i",$val))
{
$error[$key] = "Bitte eine Zahl eingeben.".$optional;
}
break;
# Datum
case "4":
// 1. Komma durch . ersetzen
$val = trim(str_replace(",",".",$val)) ;
$month = "";$day="";$year="";
if (preg_match("/^(\d{1,2}).(\d{1,2}).(\d{4})$/i", $val, $matches))
{
$month = (strlen($matches[2]) == 1) ? "0".$matches[2]:$matches[2];
$day = (strlen($matches[1]) == 1) ? "0".$matches[1]:$matches[1];
$year = $matches[3];
}
if (preg_match("/^(\d{1,2}).(\d{1,2}).(\d{2})$/i", $val, $matches))
{
$month = (strlen($matches[2]) == 1) ? "0".$matches[2]:$matches[2];
$day = (strlen($matches[1]) == 1) ? "0".$matches[1]:$matches[1];
$year = ($matches[3] < 20) ? "20".$matches[3] : "19".$matches[3];
}
if (preg_match("/^(\d{1,2})\.(\d{1,2})\.*$/i", $val, $matches))
{
$month = (strlen($matches[2]) == 1) ? "0".$matches[2]:$matches[2];
$day = (strlen($matches[1]) == 1) ? "0".$matches[1]:$matches[1];
#$year = date("Y"); // Aktuelles Jahr
}
if ($month && $day && $year)
{
$_REQUEST[$key] = $day.".".$month.".".$year ;
if (!checkdate ( $month, $day, $year))
{
$error[$key] = "Bitte ein korrektes Datum eingeben (tt.mm.yyyy).".$optional;
}
}
elseif($month && $day)
{
$_REQUEST[$key] = $day.".".$month ;
if (!checkdate ( $month, $day, 2004))
{
$error[$key] = "Bitte ein korrektes Datum eingeben (tt.mm.yyyy).".$optional;
}
}
else
{
$error[$key] = "Bitte ein korrektes Datum eingeben (tt.mm.yyyy).".$optional;
}
break;
case "5":
if(strlen($val) < 6)
{
$error[$key] = "Mindestlänge 6 Zeichen".$optional;
}
break;
case "6":
if(!isCorrectEmail($val))
{
$error[$key] = "Email scheint ungültig.".$optional;
}
break;
case "7":
if(!is_array($val))
{
$error[$key] = "Bitte auswählen.".$optional;
}
break;
case "8":
$val = trim(str_replace(",",".",$val)) ;
$_REQUEST[$key] = $val;
if(!is_float($val))
{
$error[$key] = "Bitte einen Betrag eingeben!".$optional;
}
break;
case "9":
if (strlen($val) != 5)
{
$error[$key] = "Bitte 5-stellige Zahl eingeben!".$optional;
}
break;
// Euro
case "10":
// 1. Komma durch . ersetzen
$val = trim(str_replace(",",".",$val)) ;
if(!is_numeric($val))
{
$error[$key] = "Bitte einen Betrag eingeben!".$optional;
}
$_REQUEST[$key] = number_format( $val,"2",".","");
break;
// Zeit (12:54)
case "11":
// 1. Komma durch : ersetzen
$val = trim(str_replace(",",":",$val)) ;
$hour = "";$minute="";
if (preg_match("/^(\d{1,2}):(\d{1,2})$/i", $val, $matches))
{
$hour = (strlen($matches[1]) == 1) ? "0".$matches[1]:$matches[1];
$minute = (strlen($matches[2]) == 1) ? "0".$matches[2]:$matches[2];
}
if ($hour && $minute)
{
$_REQUEST[$key] = $hour.":".$minute ;
if ($hour >23 || $hour <0 || $minute > 59 || $minute < 0)
{
$error[$key] = "Bitte eine korrekte Zeit eingeben (ss:mm).".$optional;
}
}
else
{
$error[$key] = "Bitte eine korrekte Zeit eingeben (ss:mm).".$optional;
}
break;
}//switch
}//for
return $error;
}
function changeDate(&$val)
{
// 1. Komma durch . ersetzen
$val = trim(str_replace(",",".",$val)) ;
$month = "";$day="";$year="";
if (preg_match("/^(\d{1,2}).(\d{1,2}).(\d{4})$/i", $val, $matches))
{
$month = (strlen($matches[2]) == 1) ? "0".$matches[2]:$matches[2];
$day = (strlen($matches[1]) == 1) ? "0".$matches[1]:$matches[1];
$year = $matches[3];
}
if (preg_match("/^(\d{1,2}).(\d{1,2}).(\d{2})$/i", $val, $matches))
{
$month = (strlen($matches[2]) == 1) ? "0".$matches[2]:$matches[2];
$day = (strlen($matches[1]) == 1) ? "0".$matches[1]:$matches[1];
$year = ($matches[3] < 20) ? "20".$matches[3] : "19".$matches[3];
}
if (preg_match("/^(\d{1,2}).(\d{1,2})$/i", $val, $matches))
{
$month = (strlen($matches[2]) == 1) ? "0".$matches[2]:$matches[2];
$day = (strlen($matches[1]) == 1) ? "0".$matches[1]:$matches[1];
$year = date("Y"); // Aktuelles Jahr
}
if ($month && $day && $year)
{
$_REQUEST[$key] = $day.".".$month.".".$year ;
if (!checkdate ( $month, $day, $year))
{
$error[$key] = "Bitte ein korrektes Datum eingeben.";
}
}
else
{
$error[$key] = "Bitte ein korrektes Datum eingeben.";
}
}
// *****************************************************************
// Name isCorrectEmail
//
// EingabePara: $email
//
// AusgabePara:
//
// Funktion: Prüft auf plausible Emailadresse
//
// *****************************************************************
function isCorrectEmail($email)
{
if( !eregi( "^" .
"[a-z0-9]+([_\\.-][a-z0-9]+)*" . //user
"@" .
"([a-z0-9]+([\.-][a-z0-9]+)*)+" . //domain
"\\.[a-z]{2,}" . //sld, tld
"$", $email, $regs))
{
return false;
}
else
{
return true ;
}
} //function
?>
make your story