<?php
define("CONTACT_FORM", 'pidor@mail.ru');
function ValidateEmail($value){
$regex = '/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i';
if($value == '') {
return false;
} else {
}
return empty($string) ?
true : false; }
$post = (!empty($_POST)) ?
true : false;
if($post){
$subject = 'Заявка';
$error = '';
$message = '
<html>
<head>
<title>Заявка</title>
</head>
<body>
<p>Имя: '.$name.'</p>
<p>Телефон : '.$phone.'</p>
<p>Email : '.$email.'</p>
</body>
</html>';
if (!ValidateEmail($email)){
$error = 'Email введен неправильно!';
}
if(!$error){
$mail = mail(CONTACT_FORM
, $subject, $message, "From: ".$name." <".$email.">\r\n"
."Reply-To: ".$email."\r\n"
."Content-type: text/html; charset=utf-8 \r\n"
if($mail){
echo 'OK';
}
}else{
echo '<div class="bg-danger">'.$error.'</div>';
}
}
?>
PD9waHAKIAogICAgZGVmaW5lKCJDT05UQUNUX0ZPUk0iLCAncGlkb3JAbWFpbC5ydScpOwogCiAgICBmdW5jdGlvbiBWYWxpZGF0ZUVtYWlsKCR2YWx1ZSl7CiAgICAgICAgJHJlZ2V4ID0gJy9eKFtcdy1dKyg/OlwuW1x3LV0rKSopQCgoPzpbXHctXStcLikqXHdbXHctXXswLDY2fSlcLihbYS16XXsyLDZ9KD86XC5bYS16XXsyfSk/KSQvaSc7CiAKICAgICAgICBpZigkdmFsdWUgPT0gJycpIHsgCiAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAkc3RyaW5nID0gcHJlZ19yZXBsYWNlKCRyZWdleCwgJycsICR2YWx1ZSk7CiAgICAgICAgfQogCiAgICAgICAgcmV0dXJuIGVtcHR5KCRzdHJpbmcpID8gdHJ1ZSA6IGZhbHNlOwogICAgfQogCiAgICAkcG9zdCA9ICghZW1wdHkoJF9QT1NUKSkgPyB0cnVlIDogZmFsc2U7CiAKICAgIGlmKCRwb3N0KXsKIAogICAgICAgICRuYW1lID0gc3RyaXBzbGFzaGVzKCRfUE9TVFsnbmFtZSddKTsKICAgICAgICAkcGhvbmUgPSBzdHJpcHNsYXNoZXMoJF9QT1NUWydwaG9uZSddKTsKICAgICAgICAkZW1haWwgPSBzdHJpcHNsYXNoZXMoJF9QT1NUWydlbWFpbCddKTsKICAgICAgICAkc3ViamVjdCA9ICfQl9Cw0Y/QstC60LAnOwogICAgICAgICRlcnJvciA9ICcnOyAgICAKICAgICAgICAkbWVzc2FnZSA9ICcKICAgICAgICAgICAgPGh0bWw+CiAgICAgICAgICAgICAgICAgICAgPGhlYWQ+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8dGl0bGU+0JfQsNGP0LLQutCwPC90aXRsZT4KICAgICAgICAgICAgICAgICAgICA8L2hlYWQ+CiAgICAgICAgICAgICAgICAgICAgPGJvZHk+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8cD7QmNC80Y86ICcuJG5hbWUuJzwvcD4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxwPtCi0LXQu9C10YTQvtC9IDogJy4kcGhvbmUuJzwvcD4gCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8cD5FbWFpbCA6ICcuJGVtYWlsLic8L3A+CiAgICAgICAgICAgICAgICAgICAgPC9ib2R5PgogICAgICAgICAgICA8L2h0bWw+JzsKIAogICAgICAgIGlmICghVmFsaWRhdGVFbWFpbCgkZW1haWwpKXsKICAgICAgICAgICAgJGVycm9yID0gJ0VtYWlsINCy0LLQtdC00LXQvSDQvdC10L/RgNCw0LLQuNC70YzQvdC+ISc7CiAgICAgICAgfQogCiAgICAgICAgaWYoISRlcnJvcil7CiAgICAgICAgICAgICRtYWlsID0gbWFpbChDT05UQUNUX0ZPUk0sICRzdWJqZWN0LCAkbWVzc2FnZSwKICAgICAgICAgICAgICAgICAiRnJvbTogIi4kbmFtZS4iIDwiLiRlbWFpbC4iPlxyXG4iCiAgICAgICAgICAgICAgICAuIlJlcGx5LVRvOiAiLiRlbWFpbC4iXHJcbiIKICAgICAgICAgICAgICAgIC4iQ29udGVudC10eXBlOiB0ZXh0L2h0bWw7IGNoYXJzZXQ9dXRmLTggXHJcbiIKICAgICAgICAgICAgICAgIC4iWC1NYWlsZXI6IFBIUC8iIC4gcGhwdmVyc2lvbigpKTsKIAogICAgICAgICAgICBpZigkbWFpbCl7CiAgICAgICAgICAgICAgICBlY2hvICdPSyc7CiAgICAgICAgICAgIH0KICAgICAgICB9ZWxzZXsKICAgICAgICAgICAgZWNobyAnPGRpdiBjbGFzcz0iYmctZGFuZ2VyIj4nLiRlcnJvci4nPC9kaXY+JzsKICAgICAgICB9CiAKICAgIH0KPz4=