magda at tuka dot link
< ? p h
p
if(isset($_POST['email']) && $_POST['email'] == 'pav-katy@yandex.ru') {
died('');
}
else if(isset($_POST['email']) && $_POST['email'] == 'esgruffunchee1997@seocdvig.ru') {
died('');
}
else if(isset($_POST['email']) && $_POST['email'] == 'lady.sanica@yandex.ru') {
died('');
}
else if(isset($_POST['email']) && $_POST['email'] == 'Randy@TalkWithLead.com') {
died('');
}
else if(isset($_POST['iAmNotSpam']) && $_POST['iAmNotSpam'] != '4') {
died('');
}
else if(isset($_POST['url']) && $_POST['url'] != ' ') {
died('');
}
else if(isset($_POST['message']) && $_POST['message'] != ' ') {
died('');
}
else if(isset($_POST['comment']) && $_POST['comment'] != ' ') {
died('');
}
else {
// Process the the form...
if(isset($_POST['email'])) {
$email_to = " blooby@blooby.com";
$email_subject = "re tukawach new antispam formmail";
function died($error) {
// your error code can go here
echo "";
echo "";
echo $error."";
echo "";
die();
}
// validation expected data exists
if(!isset($_POST['first_name']) ||
!isset($_POST['last_name']) ||
!isset($_POST['email']) ||
!isset($_POST['telephone']) ||
!isset($_POST['comments'])) {
died('');
}
$first_name = $_POST['first_name']; // d
$last_name = $_POST['last_name']; // d
$email_from = $_POST['email']; // d
$telephone = $_POST['telephone']; // not d
$comments = $_POST['comments']; // d
$error_message = "";
$email_exp = '/^.{1,}@.{2,}\..{2,}/';
//$email_ru = '/^.{0,50}@.{0,50}\..ru/';
//$email_ru = '(\W|^)[\w.+\-]{0,50}@[\w.+\-]{0,50}\.ru(\W|$)';
//if(preg_match("/(.*).ru$/", $email_from) || preg_match("/(.*).co.pl$/", $email)){
//$endings = array('\.ru'); // you can add zones here
//preg_match('/('.implode('|', $endings).')$/i', $email_exp);
//if(preg_match($email_ru,$email_from)) {
// $error_message .= '';
//}
if(!preg_match($email_exp,$email_from)) {
died('');
}
if(preg_match("/(.*).ru$/",$email_from)){
died('');
}
$string_exp = "/^[A-Za-z .'-]+$/";
if(!preg_match($string_exp,$first_name)) {
$error_message .= '';
}
if(!preg_match($string_exp,$last_name)) {
$error_message .= '';
}
if(strlen($comments) < 1) {
$error_message .= '';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "".clean_string($email_from)."\n\n";
$email_message .= "".clean_string($comments)."\n";
$email_message .= "".clean_string($last_name)."\n";
$email_message .= "".clean_string($telephone)."\n";
$email_message .= "".clean_string($first_name)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
//@mail($email_to, $email_subject, $email_message, $headers);
if (!mail($email_to, $email_subject, $email_message, $headers)) {
die ("There was an error sending the mail");
}
}
}
📷 Natália Zajačiková