Adding reCAPTCHA to form

Adding reCAPTCHA to form

am 16.04.2010 20:34:13 von Ernie Kemp

------=_NextPart_000_0034_01CADD71.E32A3EC0
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_0035_01CADD71.E32A3EC0"


------=_NextPart_001_0035_01CADD71.E32A3EC0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit



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

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








// 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.";



}

}

?>








































------=_NextPart_001_0035_01CADD71.E32A3EC0
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:dt=3D"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40">



charset=3Dus-ascii">





lang=3DEN-CA
link=3D"#996600" vlink=3D"#666666">
v:src=3D"cid:image001.jpg@01CADD71.2763DF20" v:shapes=3D"_x0000_Mail" =
width=3D0
height=3D0 class=3Dshape style=3D'display:none;width:0;height:0'>



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>Need help with reCAPTCHA. Never installed it =
before.



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>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.



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>The reCPATCHA show correctly but I need some help =
here.



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>Thanks very much again,



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>..../Ernie



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>****************************************** *************=
****



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'><form =
action=3D"quoterequest-redirect.php"
method=3D"post" >



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'><td>



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>    <?php



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>        // call the =
lib..



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>       
require_once('recaptchalib.php');



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>        // Get a =
key from
http://recaptcha.net/api/getkey



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>        $publickey =
=3D
"6LeGhwwAAAAAADNm2bEIkxzNHXIjpAlGYJ5NCYju";
p>

style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>        $privatekey =
=3D
"6LeGhwwAAAAAAFbi37aANuHliCnZ-_jg3uN8N7oh";
p>

style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>        =



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>        # the =
response
from reCAPTCHA



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>        $resp =3D =
null;



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>        # the error =
code
from reCAPTCHA, if any



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>        $error =3D =
null;



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>        =



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>        # was there =
a
reCAPTCHA response?



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>        if
($_POST["submit"]) {



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>         &=
nbsp; 
$response =3D recaptcha_check_answer($privatekey,



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>         &=
nbsp;     
$_SERVER["REMOTE_ADDR"],



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>         &=
nbsp;     
$_POST["recaptcha_challenge_field"],



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>         &=
nbsp;     
$_POST["recaptcha_response_field"]);



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>         =



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>      =
          if
($response->is_valid) {



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>         &=
nbsp;           &n=
bsp; 
echo "Yes, that was correct!";



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>         &=
nbsp;     
} else {



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>         &=
nbsp;           &n=
bsp; 
# set the error code so that we can display it



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>         &=
nbsp;     
echo "Eh, That wasn't right. Try =
Again.";



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>         =



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>         &=
nbsp;     
}



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>        =
}



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>    ?>



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>    <?php echo
recaptcha_get_html($publickey, $error); ?>



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'></td>



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'>   <input type=3D"submit"
name=3D"submit" id=3D"submit" =
value=3D"Submit" />



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'> </form>



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:windowtext'> 



style=3D'font-size:11.0pt;font-family:"Ancestory SF";
color:windowtext'> 



style=3D'font-size:11.0pt;font-family:"Ancestory SF";
color:windowtext'> 



style=3D'font-size:11.0pt;font-family:"Ancestory SF";
color:windowtext'> 



 









------=_NextPart_001_0035_01CADD71.E32A3EC0--

------=_NextPart_000_0034_01CADD71.E32A3EC0--