Recaptcha is not validated

0

My problem is that my reCAPTCHA is not validated, this is the message I get:

  

We detected that your site is not verifying reCAPTCHA solutions.   This is required for the proper use of reCAPTCHA on your site.   Please see our developer site for more information. "

How could I fix it? I leave the code PHP :

<?php
 //Variables del formulario de contacto


@$nombre = addslashes($_POST['nombre']);
@$email = addslashes($_POST['email']);
@$contenido = addslashes($_POST['contenido']);
@$mensaje = addslashes($_POST['mensaje']);




//Mensaje de contacto
 $cabeceras = "From: Renovaburgos"
  . ": $email";
 $asunto = "Mensaje desde la pagina Web";
 $email_to = "[email protected]";
 $contenido = "$contenido"
 ."\n"
 . "Nombre: $nombre\n"
 . "Email: $email\n"
 . "Contenido: $contenido\n"
 . "Mensaje: $mensaje\n"
 ."\n";


 $captcha =  isset( $_POST['g-recaptcha-response'] ) ? $_POST['g-recaptcha-response'] : '';
if (!$captcha) {
   die('Por favor resuelva el captcha');
}

$secret = '---------------';
$response = json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secret."&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']), true);

if ($response['success'] === true) {
   // Aqui envías el correo del formulario etc

   echo "<script language='javascript'>
alert('Mensaje enviado, muchas gracias.');
window.location.href = 'http://renovaburgos.com';
 </script>";
} else {
   die('Captcha incorrecto, actualice la página pulsando F5');
}
    
asked by jose 22.01.2018 в 18:38
source

0 answers