Advertisement
Guest User

notification fields disappeared

a guest
Apr 20th, 2018
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. <?php
  2. $recipients = 'marketing@first-beauty.it';
  3.  
  4. try {
  5. require './phpmailer/PHPMailerAutoload.php';
  6.  
  7. preg_match_all("/([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)/", $recipients, $addresses, PREG_OFFSET_CAPTURE);
  8.  
  9. if (!count($addresses[0])) {
  10. die('MF001');
  11. }
  12.  
  13. if (preg_match('/^(127\.|192\.168\.)/', $_SERVER['REMOTE_ADDR'])) {
  14. die('MF002');
  15. }
  16.  
  17. $template = file_get_contents('rd-mailform.tpl');
  18.  
  19. if (isset($_POST['form-type'])) {
  20. switch ($_POST['form-type']){
  21. case 'contact':
  22. $subject = 'A message from your site visitor';
  23. break;
  24. case 'subscribe':
  25. $subject = 'Subscribe request';
  26. break;
  27. case 'order':
  28. $subject = 'Order request';
  29. break;
  30. default:
  31. $subject = 'A message from your site visitor';
  32. break;
  33. }
  34. }else{
  35. die('MF004');
  36. }
  37.  
  38. if (isset($_POST['email'])) {
  39. $template = str_replace(
  40. array("<!-- #{FromState} -->", "<!-- #{FromEmail} -->"),
  41. array("Email:", $_POST['email']),
  42. $template);
  43. }else{
  44. die('MF003');
  45. }
  46.  
  47. if (isset($_POST['message'])) {
  48. $template = str_replace(
  49. array("<!-- #{MessageState} -->", "<!-- #{MessageDescription} -->"),
  50. array("Message:", $_POST['message']),
  51. $template);
  52. }
  53.  
  54. preg_match("/(<!-- #{BeginInfo} -->)(.|\n)+(<!-- #{EndInfo} -->)/", $template, $tmp, PREG_OFFSET_CAPTURE);
  55. foreach ($_POST as $key => $value) {
  56. if ($key != "email" && $key != "message" && $key != "form-type" && !empty($value)){
  57. $info = str_replace(
  58. array("<!-- #{BeginInfo} -->", "<!-- #{InfoState} -->", "<!-- #{InfoDescription} -->"),
  59. array("", ucfirst($key) . ':', $value),
  60. $tmp[0][0]);
  61.  
  62. $template = str_replace("<!-- #{EndInfo} -->", $info, $template);
  63. }
  64. }
  65.  
  66. $template = str_replace(
  67. array("<!-- #{Subject} -->", "<!-- #{SiteName} -->"),
  68. array($subject, $_SERVER['SERVER_NAME']),
  69. $template);
  70.  
  71. $mail = new PHPMailer();
  72. $mail->From = $_POST['email'];
  73. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement