i posted an online form from scriptsmill without a captcha code the other day. i got some creative posts! :rolleyes:
lessons learned FAST - to lock it down a little better.
i remembered i have an account on recaptcha and setup the keys for my new site (where the comment form is)
how do i successfully paste and consolidate two (submit)forms into one php file.
whenever i add the recaptcha 'section' into the default template - the page shows blank.
i basically break the working code.
individually i can display the captcha form OR the comment form,
i believe they are both working, the mysql database appears to be updating successfully.
i need these two to play nice in the sandbox.
the comments form actually requires a bunch of sequential php files.
the recapture form starts like this
<form action="" method="post">
<?php
require_once('recaptchalib.php');
$publickey = " ... ";
$privatekey = " ... ";
the response from reCAPTCHA
$resp = null;
the error code from reCAPTCHA, if any
$error = null;
are we submitting the page?
if ($POST["submit"]) {
$resp = recaptcha_check_answer ($privatekey,
$SERVER["REMOTE_ADDR"],
$POST["recaptcha_challenge_field"],
$POST["recaptcha_response_field"]);
if ($resp->is_valid) {
echo "You got it!";
in a real application, you should send an email, create an account, etc
} else {
set the error code so that we can display it. You could also use
die ("reCAPTCHA failed"), but using the error message is
more user friendly
$error = $resp->error;
}
}
echo recaptcha_get_html($publickey, $error);
?>
<br/>
<input type="submit" name="submit" value="submit" />
</form>
I laughed at the echo You Got IT! well that's nice but I would like it to
actually take action rather than post a silly comment.
Unless I misunderstand, after the captcha is valid, then submit to my
database - is that right?
how do I edit this and put it into an existing comment form?
thanks in advance