From f208de2a34a4f53f88b312cfde003bdbfe9c17f0 Mon Sep 17 00:00:00 2001 From: hxcde <30338980+hxcde@users.noreply.github.com> Date: Tue, 28 Mar 2023 12:18:30 +0200 Subject: [PATCH] Create contact-form-process.php --- contact-form-process.php | 69 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 contact-form-process.php diff --git a/contact-form-process.php b/contact-form-process.php new file mode 100644 index 0000000..0476e47 --- /dev/null +++ b/contact-form-process.php @@ -0,0 +1,69 @@ +
"; + echo $error . "

"; + echo "

"; + die(); + } + + if ( + !isset($_POST['Name']) || + !isset($_POST['Message']) + ) { + problem('Es gibt ein Problem mit deiner Eingabe:'); + } + + $name = $_POST['Name']; + $email = 'anonym@heliservice.adac.de'; + $message = $_POST['Message']; + + $error_message = ""; + $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; + + if (!preg_match($email_exp, $email)) { + $error_message .= 'na .
'; + } + + $string_exp = "/^[A-Za-z .'-]+$/"; + + if (!preg_match($string_exp, $name)) { + $error_message .= 'Das eingetragene Anliegen scheint nicht gültig zu sein!
'; + } + + if (strlen($message) < 2) { + $error_message .= 'Die eingetragene Nachricht scheint nicht gültig zu sein!
'; + } + + if (strlen($error_message) > 0) { + problem($error_message); + } + +// Formular + + function clean_string($string) + { + $bad = array("content-type", "bcc:", "to:", "cc:", "href"); + return str_replace($bad, "", $string); + } + + $email_message .= "Anliegen: " . clean_string($name) . "\n"; + $email_message .= "Nachricht: " . clean_string($message) . "\n"; + + // email header + $headers = 'From: ' . $email . "\r\n" . + 'Reply-To: ' . $email . "\r\n" . + 'X-Mailer: PHP/' . phpversion(); + @mail($email_to, $email_subject, $email_message, $headers); +?> + + Deine Nachricht wurde versendet! + +