web_dor_captchareturn

The Business Responsive web dor captchareturn function.

Description

web_dor_captchareturn(); 

Usage

  1. if ( !function_exists( 'web_dor_captchareturn' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = web_dor_captchareturn(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/functions.php  
  1. function web_dor_captchareturn() { 
  2.  
  3.  
  4. //Check to see if the honeypot captcha field was filled in 
  5. @session_start(); 
  6.  
  7. if ( trim( $_GET['captcha_key'] ) !== $_SESSION['web_dor_them_cap_code'] ) { 
  8. $captchaError = true; 
  9. echo '3'; 
  10. exit; 
  11. } else { 
  12.  
  13. //Check to make sure that the name field is not empty 
  14. if ( trim($_GET['name']) === '') { 
  15. echo '4'; 
  16. exit; 
  17. $nameError = 'You forgot to enter your name.'; 
  18. $hasError = true; 
  19. } else { 
  20. $name = trim( $_GET['name'] ); 
  21.  
  22.  
  23. //If there is no error, send the email 
  24. if(isset($_GET['captcha_key'])) 
  25. $code=$_GET['captcha_key']; 
  26. else 
  27. $code=''; 
  28.  
  29. if($code!='' and $code==$_SESSION['web_dor_them_cap_code'] ) { 
  30. global $post;  
  31. $email=$_GET['email']; 
  32. $web_business_meta = get_post_meta( $_GET['curenid'], '_web_business_meta', TRUE ); 
  33. $emailTo = $web_business_meta['email_to']; 
  34. $subject = $_GET['message_title']; 
  35. $comments=$_GET['message']; 
  36. $sendCopy = $_GET['sendcopy']; 
  37. $body = "Name: $name \n\nEmail: $email \n\nComments: $comments"; 
  38. $mail_send = wp_mail($emailTo, $subject, $body, ''); 
  39. if(!$mail_send) { 
  40. echo '5'; 
  41. exit; 
  42. if ( $sendCopy == true ) { 
  43. $subject = $_GET['message_title']; 
  44. $mail_send = wp_mail($email, $subject, $body, ''); 
  45. if(!$mail_send) { 
  46. echo '5'; 
  47. exit; 
  48.  
  49.  
  50. echo '1'; 
  51.  
  52.  
  53.  
  54.  
  55. die(); 
  56.  
  57.