Email validation failed

"; } if ($_POST['name'] && strlen($_POST['name']) <= 30) { $name = htmlspecialchars($_POST['name']); } else { $ok = false; echo "

Name validation failed

"; } if ($_POST['body'] && strlen($_POST['body']) <= 2000) { $body = htmlspecialchars($_POST['body']); } else { $ok = false; echo "

Message validation failed

"; } if ($_POST['g-recaptcha-response']) { $url = 'https://www.google.com/recaptcha/api/siteverify'; $params = array( 'secret' => $grecaptcha_secret_key, 'response' => $_POST['g-recaptcha-response'], ); $result = file_get_contents($url, false, stream_context_create(array( 'http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query($params) ) ))); if (!json_decode($result, true)['success']) { $ok = false; echo "

recaptcha remote validation failed

"; } } else { $ok = false; echo "

recaptcha validation failed

"; } if ($ok) { $ip = $_SERVER["REMOTE_ADDR"]; $message = "Message from $name <$email>, ip: $ip\r\n $body"; $answer = (int)$_POST["answ"]; $headers = 'From: Contact Form ' . "\r\n" . 'Reply-To: No Reply ' . "\r\n" . 'Content-Type: text/plain; charset=UTF-8; format=flowed' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail('info@teamfnd.ru', "Contact Form on teamfnd.ru from $name <$email>", $message, $headers); ?>

Success!

Your message has been sent.

We will reply you as soon as it is possilble.

You will be redirected back on site soon.

'; } else { echo '

Validation failed. Please check your data

'; } } else { echo 'Method not allowed'; } ?>