draj30958 2014-01-03 17:46
浏览 48
已采纳

reCaptcha没有在注册页面上工作

I run a NFL pick em site and lately have been getting a lot of spam. My sign up page just throws the info from the sign up form in to a database, but I can't figure out how to get reCaptcha working.

I have the captcha showing up and everything, but currently it does not matter if you fill out the captcha or not... I've even typed random letters in it and it still went through. So basically you can sign up for my site and ignore the captcha all together.

Here is my code:

(I couldn't get the code to format properly on here...)

Signup.php-Pastebin.com

  • 写回答

1条回答 默认 最新

  • drux41001 2014-01-03 17:50
    关注

    If you fail validation you are just filling an errors array and continuing with your script.

    // begin: reCAPTCHA - VALIDATE
    $resp = recaptcha_check_answer ($privatekey,
                            $_SERVER["REMOTE_ADDR"],
                            $_POST["recaptcha_challenge_field"],
                            $_POST["recaptcha_response_field"]);
    
    if (!$resp->is_valid) {
        $errors[] = 'Please enter a valid captcha';
    }
    // end: reCAPTCHA - VALIDATE
    

    You need to wrap everything after this point in an else block, otherwise you just fill your $errors array and happily proceed with the rest of your page. You aren't even using your $errors array later.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置