Adding reCAPTCHA to form

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Need help with reCAPTCHA. Never installed it before.

When Submit is clicked the "quoterequest-redirect.php" is run but I think it would be better to test the reCAPTCHA before the "quoterequest-redirect.php" program has been run.

The reCPATCHA show correctly but I need some help here.

 

Thanks very much again,

..../Ernie

***********************************************************

<form action="" method="post" >

<td>

    <?php

 

        // call the lib..

        require_once('recaptchalib.php');

 

        // Get a key from http://recaptcha.net/api/getkey

        $publickey = "6LeGhwwAAAAAADNm2bEIkxzNHXIjpAlGYJ5NCYju";

        $privatekey = "6LeGhwwAAAAAAFbi37aANuHliCnZ-_jg3uN8N7oh";

       

        # the response from reCAPTCHA

        $resp = null;

        # the error code from reCAPTCHA, if any

        $error = null;

       

        # was there a reCAPTCHA response?

        if ($_POST["submit"]) {

            $response = recaptcha_check_answer($privatekey,

                $_SERVER["REMOTE_ADDR"],

                $_POST["recaptcha_challenge_field"],

                $_POST["recaptcha_response_field"]);

        

                if ($response->is_valid) {

                        echo "Yes, that was correct!";

                } else {

                        # set the error code so that we can display it

                echo "Eh, That wasn't right. Try Again.";

        

                }

        }

    ?>

    <?php echo recaptcha_get_html($publickey, $error); ?>

</td>

   <input type="submit" name="submit" id="submit" value="Submit" />

 </form>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux