reCaptcha - Dreamweaver CS3 html/php

94 views
Skip to first unread message

Lexie \m/x

unread,
Nov 9, 2009, 6:26:27 PM11/9/09
to reCAPTCHA
Hi guys

I'm using Dreamweaver CS3 to create a website complete with online
enquiry form. The form has been made using html & I've also done the
php file to go with it to make the form work. I am new to php though.

I would like to add reCaptcha to the bottom of the form to be entered
before hitting the submit button. I've registered with reCaptcha &
have my Public Key & Private Key. I need help with what code needs to
be entered.

1) The html code to display the reCaptcha widget within the form

&

2) The php code to make the reCaptcha work

Any help would be greatly appreciated.

Cheers

Lexie
Message has been deleted

Lexie \m/x

unread,
Nov 9, 2009, 10:44:41 PM11/9/09
to reCAPTCHA
This within my html file??

<form id="form1" name="form1" method="post" action="sendmail.php">
*<!-- ... more of your form code here ... -->*
<td colspan="2"><div align="right"><script type="text/javascript"
src="http://api.recaptcha.net/challenge?k=your_public_key">
</script>
<noscript>
<iframe src="http://api.recaptcha.net/noscript?
k=your_public_key"
height="300" width="500" frameborder="0"></iframe>
<?php
require_once('recaptchalib.php');
$publickey = "your_public_key";
echo recaptcha_get_html($publickey);
?>
<br>
</noscript>
</div></td>
*<!-- ... more of your form code here ... -->*
</form>

& this within my php file??

<?php
*<!-- ... more of your php code here ... -->*
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) {
die ("The reCAPTCHA wasn't entered correctly. Go back and try it
again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {
mail( "ea...@addy.com.au", "Online Quotation Request",
$message, "From: $email" );
header( "Location: http://www.yourdomain.com.au/thankyou.html" );
}
?>

Lexie \m/x

unread,
Nov 10, 2009, 7:02:50 PM11/10/09
to reCAPTCHA
With the code above, I have successfully displayed the widget,
however, when clicking submit I get this error message "The reCAPTCHA
wasn't entered correctly. Go back and try it again.(reCAPTCHA said:
invalid-site-private-key)"
Reply all
Reply to author
Forward
0 new messages