Answer the question
In order to leave comments, you need to log in
How to add spam protection to the feedback form?
Good afternoon developers.
Tell me how to add spam protection to the feedback form? Simple landing, without cms and recaptcha.
Thanks in advance.
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (isset($_POST['formData'])) {$formData = $_POST['formData'];}
if (isset($_POST['email'])) {$email = $_POST['email'];}
if (isset($_POST['name'])) {$name = $_POST['name'];}
if (isset($_POST['phone'])) {$phone = $_POST['phone'];}
if (isset($_POST['message'])) {$message = $_POST['message'];
}
$to = почта@mail.ru";
$headers = "Content-type: text/plain; charset = utf-8";
$subject = "$formData";
$message = "$formData\n\nОткуда: $email \n\nОтправитель: $name \n\nТелефон: $phone \n\nСообщение: $message";
$send = mail ($to, $subject, $message, $headers);
if ($send == 'true') {
echo "<center>Спасибо за отправку вашего сообщения! Наши специалисты свяжутся с вами в течение часа.</center>";
} else {
echo "<center><b>Ошибка. Сообщение не отправлено! Проверьте правильность введенных данных</b></center>";
}
} else {
http_response_code(403);
echo "Попробуйте еще раз";
}
?>
Answer the question
In order to leave comments, you need to log in
Related article https://www.lifewire.com/solutions-to-protect-web-...
Hidden field, on the server we check if it is spam, 95% of bots will be eliminated
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question