Advertisement
Guest User

my PHP-Process file

a guest
May 5th, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.47 KB | None | 0 0
  1. <?php
  2.     $event_date = $_POST['event_date'];
  3.     $name = $_POST['full_name'];
  4.     $event_type = $_POST['event_type'];
  5.     $telephone = $_POST['telephone'];
  6.     $email = $_POST['email'];
  7.  
  8.    
  9.    $email_from = 'mywebsiteemail@gmail.com';
  10.  
  11.     $email_subject = "New Form submission from your website";
  12.  
  13.     $email_body = "You have received a new message via your websites form from $name.\n".
  14.                             "The date requested for the event is:\n     $event_date\n".
  15.        
  16.     "The type of event is:\n $event_type \n".
  17.        
  18.     "The customers contact telephone number is:\n $telephone \n".
  19.    
  20.     "From:\n $email \n".
  21.        
  22.    
  23.   $to = "myclientsemail@gmail.com";
  24.   $headers = "From: $email_from \r\n";
  25.   $headers = "Reply-To: $email \r\n";
  26.     mail($to,$email_subject,$email_body,$headers);
  27.  
  28.  
  29.  
  30.  
  31. //Load thank you page once form is submitted
  32.  
  33. header ('Location: contact-thank-you.html');
  34. exit();
  35.  
  36.  
  37.  
  38. ?>
  39.  
  40. <?php
  41.  
  42. function IsInjected($str)
  43. {
  44.     $injections = array('(\n+)',
  45.            '(\r+)',
  46.            '(\t+)',
  47.            '(%0A+)',
  48.            '(%0D+)',
  49.            '(%08+)',
  50.            '(%09+)'
  51.            );
  52.                
  53.     $inject = join('|', $injections);
  54.     $inject = "/$inject/i";
  55.      
  56.     if(preg_match($inject,$str))
  57.     {
  58.       return true;
  59.     }
  60.     else
  61.     {
  62.       return false;
  63.     }
  64. }
  65.  
  66. if(IsInjected($visitor_email))
  67. {
  68.     echo "Bad email value!";
  69.     exit;
  70. }
  71.  
  72. error_reporting(-1);
  73.  
  74. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement