$zip = filter_input(INPUT_POST, 'zip'); $errors = []; if (empty($mail) && empty($zip)) { $errors[] = 'Bitte geben Sie Ihre E-Mail-Adresse und Postleitzahl ein.'; } else { // collecting errors for mail if (empty($mail)) { $errors[] = 'Bitte geben Sie Ihre E-Mail-Adresse ein.'; } if (!filterEmail($mail)) { $errors[] = 'Dies ist keine gültige E-Mail-Adresse.'; } if (!checkIfMailExists($mail, $db)) { $errors[] = 'Diese E-Mail-Adresse wird bereits verwendet.'; } // collecting errors for zip if (empty($zip)) { $errors[] = 'Bitte geben Sie Ihre Postleitzahl ein.'; } if (!filterInt($zip)) { $errors[] = 'Die Postleitzahl muss eine Zahl sein.'; } elseif (!filterZip($zip)) { $errors[] = 'Diese Postleitzahl ist ungültig.'; } } if (empty($errors)) { $subscribed = subscribe($mail, $zip, $db); $sent = sendSuccessMail($mail); $success = 'Sie haben sich erfolgreich für den Newsletter angemeldet.'; } }
if (isset($_POST['product_user']) && !empty($_POST['product_user'])) { $product_user = filterString($_POST['product_user']); if ($product_user) { $data['product_user'] = $product_user; } } // Wurde ein bestimmer Zustand gesucht? Keine Pflicht if (isset($_POST['product_valence']) && !empty($_POST['product_valence'])) { $product_valence = filterInt($_POST['product_valence']); if ($product_valence) { $data['product_valence'] = $product_valence; } } // Wurde eine Postleitzahl eingegeben? Keine Pflicht if (isset($_POST['distance_zip']) && !empty($_POST['distance_zip'])) { $distance_zip = filterZip($_POST['distance_zip']); if ($distance_zip) { $data['distance_zip'] = $distance_zip; $data['distance_lat'] = $_POST['zip_latitude']; $data['distance_lon'] = $_POST['zip_longitude']; } } // Wurde eine Entfernung angegeben? Keine Pflicht if (isset($_POST['distance']) && !empty($_POST['distance'])) { $distance = filterInt($_POST['distance']); if ($distance) { $data['distance'] = $distance; } } // Wurde ein Mindestpreis angegeben? Keine Pflicht if (isset($_POST['price_from']) && !empty($_POST['price_from'])) {