Google Recaptcha gibt immer false zurückPhp

PHP-Programmierer chatten hier
Guest
 Google Recaptcha gibt immer false zurück

Post by Guest »

Ich integriere einen neuen Google Recaptcha für meinen Kunden, ich habe es müde auf meinem arbeitenden Server, alles funktioniert richtig, aber auf dem Client -Server ist der Teil (! $ captcha).

scheint JSON zu sein Jedes Mal falsch zu antworten, versuchte ich es mit einer anderen Methode, aber fehlgeschlagen. />ob_start();
require("class.phpmailer.php");
$captcha = $_POST['g-recaptcha-response'];
$mail = new PHPMailer();

$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = ""; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = ""; // SMTP username
$mail->Password = ""; // SMTP password

$Name = $_REQUEST['name'];
$Email = $_REQUEST['email'];
$Subject = $_REQUEST['subject'];
$Remarks = $_REQUEST['remarks'];

$mail->From = "";
$mail->FromName = "Vision Pilates Enquiry Form";

$mail->AddAddress("", "Admin");
//$mail->AddAddress("ellen@example.com"); // name is optional
$mail->AddReplyTo("$Email", "$Name");

$mail->WordWrap = 50; // set word wrap to 50 characters
//$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name
//$mail->IsHTML(true); // set email format to HTML

$mail->Subject = "Enquiry from website: $Subject";
$mail->Body = "Name: $Name
Email: $Email
Subject: $Subject
Remarks: $Remarks
";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if($_SERVER["REQUEST_METHOD"] === "POST") {
//form submitted

//check if other form details are correct

//verify captcha
if (!$captcha) {
echo 'Please check the the captcha form.';
exit;
}
$response = file_get_contents("https://www.google.com/recaptcha/api/si ... &response=" . $captcha . "&remoteip=" . $_SERVER['REMOTE_ADDR']);
if ($response . success == false) {
echo 'You are spammer ! Get the @$%K out';
} else {
if (!$mail->Send()) {
header("location: error.htm");
exit;
} else {
header("location: sent.htm");
}
}
}
< /code>

Nach dem Senden von Enden ist Bitte überprüfen Sie das Captcha -Formular. < /H2>. < /p>

Danke

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post