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 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程