reCAPTCHA with intergrated PHP -


i try use recaptcha , intergrated php, if code correct email sent. problem here,when type code wrong, message show wrong code, correct when type correct code go successsful page correct not receive email.

*i think maybe put script in wrong place(between if else).

<?php   require_once('recaptchalib.php');   $privatekey = "xxxxxxxxxxxxxxxxxxxxxxxx";   $resp = recaptcha_check_answer ($privatekey,                                 $_server["remote_addr"],                                 $_post["recaptcha_challenge_field"],                                 $_post["recaptcha_response_field"]);  if (!$resp->is_valid) {   die ("the recaptcha wasn't entered correctly. go , try again." .          "(recaptcha said: " . $resp->error . ")");    } else {  $full_name= $_post["full_name"]; $email= $_post["email"]; $address1= $_post["address1"]; $address2= $_post["address2"]; $postcode= $_post["postcode"]; $city= $_post["city"]; $state= $_post["state"]; $country= $_post["country"]; $telephone= $_post["telephone"]; $month= $_post["month"]; $birthday= $_post["birthday"]; $birthyear= $_post["birthyear"];  require_once('lib/class.phpmailer.php');  $mail             = new phpmailer(); // defaults using php "mail()" $mail->setfrom('ruslyrossi46@gmail.com'); $mail->addreplyto("ruslyrossi46@gmail.com"); $address = "ruslyrossi46@gmail.com"; $mail->addaddress($address); $mail->subject    = "flow"; $mail->altbody    = "to view message, please use html compatible email viewer!"; // optional, comment out , test $mail->body = "sign details<br><br>  -------------------------------------------------------------<br> first name : $full_name<br> address : $address1<br>   alternate address : $address2<br>  postcode : $postcode<br>  state : $state<br>  city : $city<br>  country : $country<br>  phone number :  $telephone<br>  email : $email<br>  birth of day :  day:$birthday  month:$month years:$birthyear<br>   thank you!<br>  ------------------------------------------------------------<br> ";   }  ?> 

you missed

if($mail->send())   {      echo 'sent';  }   else   {      echo 'error';  } 

at end (inside else last thing)

this example, customize needs.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -