Sichern eines Kontaktformularskripts
Hallo! Ich frage mich nur, wie sicher dieses Kontaktformularskript ist, das ich gerade erstellt habe. Mein Lehrer hat mich vor langer Zeit genörgelt, als ich meine Kontaktformulare machte.
if($_SERVER['REQUEST_METHOD'] === 'POST'){
$myemail = "[email protected]";
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$subject = $_POST['subject'];
$comments = $_POST['comments'];
if($name == 0 || !preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email) || !preg_match("/^\d{2}(-\d{3}){2}(\d{2})?$/", $phone) || $subject == 0 || $comments == 0){
$error_message = 'Something was written wrong..';
} else {
$message = "Hello!
Your contact form has been submitted by:
Name: $name
E-mail: $email
Phone: $phone
Comments: $comments
End of message";
mail($myemail, $subject, $message);
$error_message = 'Your message was sent!';
}
}
Irgendwelche Vorschläge, wie man es sicher macht?
P.S.Sichern eines Kontaktformulars undSichern eines PHP-Kontaktformulars sind beide für WordPress und das ist nicht das, worauf ich aus bin.