Guest User

Untitled

a guest
Mar 8th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. <?php
  2. session_start();
  3. $key=substr($_SESSION['key'],0,5);
  4. $number = $_POST['norobot'];
  5. if($number==$key){
  6. if(!$_POST) exit;
  7.  
  8. $email = $_POST['email'];
  9.  
  10.  
  11. //$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
  12. if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){
  13. $error.="Invalid email address entered";
  14. $errors=1;
  15. }
  16. if($errors==1) echo $error;
  17. else{
  18. $values = array ('name','email','message');
  19. $required = array('name','email','message');
  20.  
  21. $your_email = "barbouchhamza200341@hotmail.com barbouchhamza2011@hotmail.fr";
  22. $email_subject = "New Message: ".$_POST['subject'];
  23. $email_content = "new message:\n";
  24.  
  25. foreach($values as $key => $value){
  26. if(in_array($value,$required)){
  27. if ($key != 'subject' && $key != 'company') {
  28. if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
  29. }
  30. $email_content .= $value.': '.$_POST[$value]."\n";
  31. }
  32. }
  33. echo($email_content);
  34. if(@mail($your_email,$email_subject,$email_content,"From:".$email)) {
  35. $your_email="second@email.com";
  36. @mail($your_email,$email_subject,$email_content,"From:".$email);
  37. echo 'Message sent!';
  38. } else {
  39.  
  40. }
  41. } else {
  42. // here you place code to be executed if the captcha test fails
  43. // echo "you're a very naughty robot!";
  44. echo 'Invalid Capatcha!';
  45. }
  46.  
  47. ?>
Add Comment
Please, Sign In to add comment