0
if (isset($_POST['btnSubmit']))
{
if(isset($_POST['g-recaptcha-response'])){
$captcha=$_POST['g-recaptcha-response'];
}
echo $captcha;
if(!$captcha){
echo '<h2>Please check the the captcha form.</h2>';
exit;
}
$secretKey = "================";
$ip = $_SERVER['REMOTE_ADDR'];
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha."&remoteip=".$ip);
$responseKeys = json_decode($response,true);
if(intval($responseKeys["success"]) !== 1) {
echo '<h2>You are spammer ! Get the @$%K out</h2>';
} else {
echo '<h2>Thanks for posting comment.</h2>';
}
フォームその後、未定義の変数$ chaptchaを提出クリックしたときに、これは私に
あなたは '$ _POST [ 'G-reCAPTCHAの応答が']'定義されていることを確認したことがありますか? – IzzEps
あなたのフォームコードも投稿してください – Panda
[PHP: "Notice:Undefined variable"と "Notice:Undefined index"]の重複している可能性があります(http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-通知未定義索引) – Jocelyn