Unfortunately I have followed the instructions as per the website
to the best of my abilities, and it is not working. In an attempt to
isolate the problem, I have created a new contact template page and
added the form code in, and uploaded to my website. This page just
gives me the same error. Unfortunately, it does not display the
captcha image at all. My form displays properly, but the Captcha
image does not. my website is
www.trises.com I read somewhere about
php script not being parsed properly by server side. I don't know if
this may be the issue since I am actually getting a error code from
the script. Please be aware that at no time is the recaptcha image
displayed on the page. Under the contact tab of the website, it
provides a captcha error message after I hit the send button. Client
Side is as follows. I have just removed the public key numbers from
the public key line.
"The reCAPTCHA wasn't entered correctly. Go back and try it again.
(reCAPTCHA said: incorrect-captcha-sol)"
And yes I did a search for this error on the forums and non of the
suggestions worked.
This is the form code:
<form method="post" action="/trises/verify.php" name="contact">
<?php
require_once('recaptchalib.php');
$publickey = "******put in your public key******";
echo recaptcha_get_html($publickey);
?>
<label for="author">Name:</label> <input type="text"
class="required input_field" name="author" id="author" />
<div class="cleaner_h10"></div>
<label for="email">Email:</label> <input type="text"
class="validate-email required input_field" name="email" id="email" />
<div class="cleaner_h10"></div>
<label for="subject">Subject:</label> <input type="text"
class="validate-subject required input_field" name="subject"
id="subject"/>
<div class="cleaner_h10"></div>
<label for="text">Message:</label> <textarea id="text"
name="text" rows="0" cols="0" class="required"></textarea>
<div class="cleaner_h10"></div>
<input type="submit" value="Send" id="submit" name="submit"
class="submit_btn float_l" />
<input type="reset" value="Reset" id="reset" name="reset"
class="submit_btn float_r" />
</form>
This is the verify code:
<?php
require_once('recaptchalib.php');
$privatekey = "****private key****";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it
again." ."(reCAPTCHA said: " . $resp->error . ")");
} else {
// Your code here to handle a successful verification
$request_method = $_SERVER["REQUEST_METHOD"];
if($request_method == "GET"){
$query_vars = $_GET;
} elseif ($request_method == "POST"){
$query_vars = $_POST;
}
reset($query_vars);
$t = date("U");
$file = $_SERVER['DOCUMENT_ROOT'] . "verify_" . $t;
$fp = fopen($file,"w");
while (list ($key, $val) = each ($query_vars)) {
fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
fputs($fp,"$val\n");
fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
if ($key == "redirect") { $landing_page = $val;}
}
fclose($fp);
if ($landing_page != ""){
header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
} else {
header("Location: http://".$_SERVER["HTTP_HOST"]."/");
}
}
?>