Thread: Captcha

    #1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    436
    Rep Power
    8

    Captcha


    hi,

    I want to integrate a captcha code in my script, anyone has a trustable source which will work?
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,126
    Rep Power
    9398
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    436
    Rep Power
    8
    Thanks! I'm installing it now
  6. #4
  7. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Hi,

    yes, reCAPTCHA is pretty much the standard solution.

    I strongly recommend to keep away from home-made CAPTCHAs or the stuff people hand out in PHP tutorials. Most of it is incredibly weak and can be broken by anybody who wants to. Writing good CAPTCHAs is much more difficult than most people think it is.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    436
    Rep Power
    8
    Yes I already thought so, that is why I asked where I could get a good one.
  10. #6
  11. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    436
    Rep Power
    8
    hi, I get something strange when entering the wrong code in the captcha and the number-only captcha, I posted it on the google forms but I don't really get responses and don't expect them... Maybe you know what is wrong because you have the same problem or something

    The response I get when entering the wrong code is:
    "Could not open socket".

    And when I enter the wrong code when the captcha is number-only, I just pass the test...
  12. #7
  13. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,126
    Rep Power
    9398
  14. #8
  15. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    436
    Rep Power
    8
    of course, I followed the steps on:
    reCAPTCHA php plugin

    the script (I use 1 script):

    PHP Code:
    <?php
      
    require_once('recaptchalib.php');
      
    $privatekey "your_private_key";
      
    $resp recaptcha_check_answer ($privatekey,
                                    
    $_SERVER["REMOTE_ADDR"],
                                    
    $_POST["recaptcha_challenge_field"],
                                    
    $_POST["recaptcha_response_field"]);

      if (!
    $resp->is_valid) {
        
    // What happens when the CAPTCHA was entered incorrectly
        
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
             
    "(reCAPTCHA said: " $resp->error ")");
      } else {
        
    // Your code here to handle a successful verification
      
    }
      
    ?><html>
        <body> <!-- the body tag is required or the CAPTCHA may not show on some browsers -->
          <!-- your HTML content -->

          <form method="post" action="verify.php">
            <?php
              
    require_once('recaptchalib.php');
              
    $publickey "your_public_key"// you got this from the signup page
              
    echo recaptcha_get_html($publickey);
            
    ?>
            <input type="submit" />
          </form>

          <!-- more of your HTML content -->
        </body>
      </html>
    with this library
  16. #9
  17. No Profile Picture
    I haz teh codez!
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2003
    Posts
    2,549
    Rep Power
    2337
    I ♥ ManiacDan & requinix

    This is a sig, and not necessarily a comment on the OP:
    Please don't be a help vampire!
  18. #10
  19. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    436
    Rep Power
    8
    ok, I thought I already did that but failed-_-

    So I just go to line 40 in the recaptchalib.php and do as told at:

    https://code.google.com/p/recaptcha/issues/detail?id=26

    But is gethostbyname fast enough to NOT annoy the users with long loading times?
  20. #11
  21. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    436
    Rep Power
    8
    because I would be annoyed if a captcha is thrown at me and even more when there is a long loading time...
  22. #12
  23. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2009
    Location
    Jakarta, Indonesia.
    Posts
    206
    Rep Power
    31
    Hi.
    Aside from that error, wouldn't it need 2 scripts/ separate files for reCaptcha to work properly? As far as I could remember, I had used following scheme:
    • form.php: this is where I should use my public-key and call recaptcha_get_html() to display the captcha. Form should target verify.php below.
    • verify.php: this is where I should use my private-key and call recaptcha_check_answer().
    Last edited by hdewantara; December 17th, 2013 at 04:37 AM.
  24. #13
  25. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    436
    Rep Power
    8
    You can also use one file for the same thing, just like above...

IMN logo majestic logo threadwatch logo seochat tools logo