
Originariamente inviata da
cavicchiandrea
Se il refeesh è comandato da google puoi escluderlo (vedi api google) solo se è permesso, ma visto che ci sono diversi script in rete che questo ma meglio gestibili io cercherei un altro script
Risolto così:
prova.php
Codice PHP:
<?php session_start(); ?>
<html>
<body>
<form method="post" action="verify-captcha.php">
<input type="text" name="nome" value="<?php echo ($_SESSION['nome']); unset($_SESSION['nome']); ?>" />
<?php
require_once('recaptcha-php-1.11/recaptchalib.php');
$publickey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
echo recaptcha_get_html($publickey);
?>
<input type="submit" />
</form>
</body>
</html>
verify-captcha.php
Codice PHP:
<?phpsession_start();$nome = $_POST["nome"];
require_once('recaptcha-php-1.11/recaptchalib.php');
$privatekey = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
$_SESSION['nome']=$nome;
header("location:prova.php");
exit;
} else {
// ok
}
?>
come ti sembra?