Advertisement
Guest User

Untitled

a guest
May 18th, 2015
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # cat public_html/wp/wp-content/themes/bridge/includes/ajax_mail.php
  2. <?php
  3. require_once('recaptchalib.php');
  4. require('../../../../wp-blog-header.php');
  5. global $qode_options_proya;
  6.  
  7. $publickey = $qode_options_proya['recaptcha_public_key'];
  8. $privatekey = $qode_options_proya['recaptcha_private_key'];
  9.  
  10. if ($publickey == "") $publickey = "6Ld5VOASAAAAABUGCt9ZaNuw3IF-BjUFLujP6C8L";
  11. if ($privatekey == "") $privatekey = "6Ld5VOASAAAAAKQdKVcxZ321VM6lkhBsoT6lXe9Z";
  12.  
  13. $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
  14.  
  15. $use_captcha = $qode_options_proya['use_recaptcha'];
  16. if ($resp->is_valid || $use_captcha == "no") {
  17.         ?>success<?php
  18.  
  19.         $email_to = $qode_options_proya['receive_mail'];
  20.         $email_from = $qode_options_proya['email_from'];
  21.         $subject = $qode_options_proya['email_subject'];
  22.  
  23.         $text = "Name: " . $_POST["name"] . " " . $_POST["lastname"] . "\n";
  24.         $text .= "Email: " . $_POST["email"] . "\n";
  25.         $text .= "WebSite: " . $_POST["website"] . "\n";
  26.         $text .= "Message: " . $_POST["message"];
  27.  
  28.         $headers = "MIME-Version: 1.0" . "\r\n";
  29.         $headers .= "Content-type:text/plain; charset=utf-8" . "\r\n";
  30.         $headers .= "From: '".$_POST['name']." ".$_POST['lastname']."' <".$email_from."> " . "\r\n";
  31.  
  32.         $result = wp_mail($email_to, $subject, $text, $headers);
  33.  
  34.         if(!$result) {
  35.                 global $phpmailer;
  36.                 var_dump($phpmailer->ErrorInfo);
  37.         }
  38. }
  39. else {
  40.         die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .  "(reCAPTCHA said: " . $resp->error . ")");
  41. }
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement