reCaptcha coding question

Discussion in 'PHP' started by Nima, Aug 22, 2012.

  1. #1
    I'm trying to code reCaptcha into my website and am having some problems regenerating a new code when reCaptcha is entered incorrectly. I'm using the instructions on Google Developer page.

    This is the code I'm using in my Form:

    when someone enters a wrong captcha and click submit, I show them a text that "Captcha has been entered wrong. Go Back and correct it." The problem I'm having is that when user clicks the back button, Captcha doesn't regenerate and it never approved new entries anymore

    
                  require_once('recaptchalib.php');
                  $publickey = "MY-PUBLIC-KEY"; // you got this from the signup page
                  echo recaptcha_get_html($publickey);
    
    
    Code (markup):

    This is the code I'm using in my Success page:
    
    require_once('recaptchalib.php');
    $privatekey = "MY-KEY";
    $resp = recaptcha_check_answer ($privatekey,
                                    $_SERVER["REMOTE_ADDR"],
                                    $_POST["recaptcha_challenge_field"],
                                    $_POST["recaptcha_response_field"]);
    
    Code (markup):
    Thanks for the help
     
    Last edited: Aug 22, 2012
    Nima, Aug 22, 2012 IP
  2. plussy

    plussy Peon

    Messages:
    152
    Likes Received:
    5
    Best Answers:
    9
    Trophy Points:
    0
    #2
    ok so what is your question / problem?
     
    plussy, Aug 22, 2012 IP
  3. Nima

    Nima Well-Known Member

    Messages:
    3,489
    Likes Received:
    243
    Best Answers:
    0
    Trophy Points:
    175
    #3
    That would help, wouldnt it? lol
    Sorry, I added it to the description
     
    Nima, Aug 22, 2012 IP
  4. plussy

    plussy Peon

    Messages:
    152
    Likes Received:
    5
    Best Answers:
    9
    Trophy Points:
    0
    #4
    Can you post all your code so that I can see what you are doing at the moment?
     
    plussy, Aug 23, 2012 IP
  5. HuggyEssex

    HuggyEssex Member

    Messages:
    297
    Likes Received:
    4
    Best Answers:
    2
    Trophy Points:
    45
    #5
    Rather then letting the users use the back button create a link for them to click which will reload the form page. Just make sure you store all of the posted data into sessions so they do not have to re enter all of the information again.
     
    HuggyEssex, Aug 23, 2012 IP