I am working on a php with recaptcha and I have no idea on what I am doing, as complete newbie with php. My forms semmed to work before but now they are throwing up errrors. The error is on the if (!$resp->is_valid) lines right now.
[php]
<?php
session_start();
require_once('recaptchalib.php');
$privatekey = "removed";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
$username = $_POST['name'];
$useremail = $_POST['email'];
$recipient = "removed";
$subject = "Website Form";
$redirect = "../thankyou.html";
if (!$resp->is_valid) {
$_SESSION['mess'] = "Invalid CAPTCHA";
header("Location: http://www.puddypaws.co.uk/phps/contacts.php");
} else {
}
$message = "
================================
Name: $username
Email: $useremail
-----------------------------------------
$fmessage
================================
";
$extraheaders = "From: $useremail\n\nReply-To: $useremail\n\n";
if (! mail($recipient, $subject, $message, $extraheaders))
echo "Mail did not send for some reason.";
header("Location".$redirect);
?> [/php]
I am using the simplest form at this stage just to get the recaptcha to work, but I want to be able to get it validated in the future. Can anyone help on why I am getting errors?