Hai ragione. Chiedo umilmente scusa.
Vi posto il codice.
Codice per inserire immagine captcha nel form:
Codice PHP:
[LEFT] <?= $_SESSION['myForm']['recaptcha_response_field'];?>
<?php
was there a reCAPTCHA response?
require_once('../recaptchalib.php');
// Get a key from google.com/recaptcha/admin/create
$publickey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$privatekey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
echo recaptcha_get_html($publickey, $errors);
?>
<input type="submit" name="submit" id="submit" value="Invia Email!" tabindex="20"/> [/LEFT]
Codice per controllare se la frase inserita sia corretta o meno:
Codice PHP:
// Recaptcha: checks for the correct answer
the response from reCAPTCHA
$resp = null;
the error code from reCAPTCHA, if any
$errors = null;
//checks for a message
if (empty($_POST['recaptcha_response_field'])) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
} else {
# set the error code so that we can display it
$errors = $resp->Riprova;
}
}