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
Home
Bilder
Aufgehängt
Ed Baga
Kontakt/Anfrage
Impressum
Links

  lieferanschrift
 
     
  name   vorname  
     
  strasse   hausnummer  
     
  postleitzahl   stadt  
     
  email   geburtstag  
     
 
bildnummer
 
anzahl
 
     
     
     
     
     
 
gewünschte zahlungsweise
 
 
  vorkasse   nachnahme