Jump to content

makissm21

Neophyte
  • Posts

    1
  • Joined

  • Last visited

makissm21's Achievements

Explorer

Explorer (1/14)

0

Reputation

  1. Добрый день, прошу у вас помощи, на скрине http://shot.qip.ru/00eaLf-3EBATV0HL/ отметил красным, что бы в место этого указывался емаил $email отправителя. Помогите реализовать это, заранее благодарен за вашу помощь <?php $post = (!empty($_POST)) ? true : false; if($post) { $email = trim($_POST["email"]); $name = htmlspecialchars($_POST["name"]); $email = htmlspecialchars($_POST["email"]); $tel = htmlspecialchars($_POST["tel"]); $error = ""; if(!$name) { $error .= "Пожалуйста введите ваше имя<br />"; } // Check email function ValidateEmail($value) { $regex = "/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)*\.([a-zA-Z]{2,6})$/"; if($value == "") { return false; } else { $string = preg_replace($regex, "", $value); } return empty($string) ? true : false; } if(!$email) { $error .= "Пожалуйста введите e-mail<br />"; } if($email && !ValidateEmail($email)) { $error .= "Введите корректный e-mail<br />"; } // Check tel function ValidateTel($valueTel) { $regexTel = "/^((8|\+7)[\- ]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{7,10}$/"; if($valueTel == "") { return false; } else { $string = preg_replace($regexTel, "", $valueTel); } return empty($string) ? true : false; } if(!$tel) { $error .= "Пожалуйста введите телефон<br />"; } if($tel && !ValidateTel($tel)) { $error .= "Введите корректный телефон<br />"; } if(!$error) { $to = '89119176117@mail.ru'; $subject = '=?utf-8?B?'.base64_encode('Заявка').'?='; $headers = 'From: =?UTF-8?B?' . base64_encode($name) . '?= <=?UTF-8?B?' . base64_encode($name) . "?=>\r\n"; $headers .= 'Return-path: <' . $email . ">\r\n"; $headers .= 'Content-type: text/plain; charset=utf-8' . "\r\n"; $headers .= 'Content-Transfer-Encoding: quoted-printable' . "\r\n\r\n"; $message = "Новый запрос!\n\nИмя: $name\n\nEmail: $email\n\nТелефон: $tel\n\n"; $mail = mail($to, $subject, $message, $headers); if($mail) { echo '<div class="notification_ok2">Большое спасибо за обращение, в течении часа вам обязательно ответят</div>'; } } else { echo '<div class="notification_error2">'.$error.'</div>'; } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy