require_once('recaptchalib.php');
$privatekey = "(Some 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
$mailto = '(some email)' ;
$subject = "Eastfield Joinery New Enquiry" ;
$thankyouurl = "#thank-you" ;
$from = "(some email)";
$errorurl = "#error";
$email_is_required = 0;
$phone_is_required = 0;
$name_is_required = 1;
$surname_is_required = 1;
$comments_is_required = 1;
$uself = 0;
$forcelf = 0;
$use_envsender = 0;
$use_sendmailfrom = 0;
$use_utf8 = 1;
define( 'MAX_LINE_LENGTH', 998 );
$headersep = $uself ? "\n" : "\r\n" ;
$content_nl = $forcelf ? "\n" : (defined('PHP_EOL') ? PHP_EOL : "\n") ;
$content_type = $use_utf8 ? 'Content-Type: text/html; charset="utf-8"' : 'Content-Type: text/html; charset="iso-8859-1"' ;
if ($use_sendmailfrom) {
ini_set( 'sendmail_from', $mailto );
}
if (strlen($smtp_server_win)) {
ini_set( 'SMTP', $smtp_server_win );
}
$envsender = "-f$mailto" ;
$fullname = isset($_POST['fullname']) ? $_POST['fullname'] : $_POST['name'] ;
$surname = isset($_POST['surname']) ? $_POST['surname'] : $_POST['surname'] ;
$email = $_POST['email'] ;
$phone = $_POST ['phone'];
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );
if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (empty($email)) {
$email = $from ;
}
$fromemail = $use_webmaster_email_for_from ? $from : $email ;
if (function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}
$messageproper =
"<table border='0' cellspacing='0' cellpadding='0' width='100%'><tbody>
<tr><td align='center'><br>
<table border='0' cellspacing='0' cellpadding='0' width='600'><tbody>
<tr></tr>
</tbody></table>
<table border='0' cellspacing='0' cellpadding='0' width='600' bgcolor='#eeeeee'><tbody>
<tr><td align='center' bgcolor='white'>
<table border='0' cellspacing='0' cellpadding='5' width='100%'><tbody>
<tr><td style='text-decoration:underline; padding:5px !important; border-left:1px #000 solid; border-top:1px #000 solid;' width='170' bgcolor='white'><b>Question</b></td>
<td style='text-decoration:underline; padding:5px !important; border-left:1px #000 solid; border-top:1px #000 solid; border-right:1px #000 solid;' bgcolor='white'><b>Answer</b></td></tr>
<tr><td style='padding:5px !important; border-left:1px #000 solid; border-top:1px #000 solid;' width='170' bgcolor='white'>Name:</td>
<td style='padding:5px !important; border-left:1px #000 solid; border-top:1px #000 solid; border-right:1px #000 solid;' bgcolor='white'>$fullname $surname</td></tr>
<tr><td style='padding:5px !important; border-left:1px #000 solid; border-top:1px #000 solid;' width='170' bgcolor='white'>Email:</td>
<td style='padding:5px !important; border-left:1px #000 solid; border-top:1px #000 solid; border-right:1px #000 solid;' bgcolor='white'>$email</td></tr>
<tr><td style='padding:5px !important; border-left:1px #000 solid; border-top:1px #000 solid;' width='170' bgcolor='white'>Phone Number:</td>
<td style='padding:5px !important; border-left:1px #000 solid; border-top:1px #000 solid; border-right:1px #000 solid;' bgcolor='white'>$phone</td></tr>
<tr><td style='padding:5px !important; border-left:1px #000 solid; border-top:1px #000 solid; border-bottom:1px #000 solid;' width='170' bgcolor='white'>Enquiry:</td>
<td style='padding:5px !important; border:1px #000 solid;' bgcolor='white'>$comments</td></tr>
</tbody></table>
</td></tr>
</tbody></table>
</td></tr>
</tbody></table>" . $content_nl ;
$headers =
"From: \"$fullname $surname\" <$fromemail>" . $headersep . "Reply-To: \"$fullname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.16.8" .
$headersep . 'MIME-Version: 1.0' . $headersep . $content_type ;
$headers .= "Bcc: (Some email)\r\n";
if ($use_envsender) {
mail($mailto, $subject, $messageproper, $headers, $envsender );
}
else {
mail($mailto, $subject, $messageproper, $headers );
}
header( "Location: $thankyouurl" );
exit ;
}
?>
So that's my current code. I have tried various positions of the reCaptcha code, I've also tried a different form process altogether, but I still get the "Could not open socket" error.