/    Sign up×
Community /Pin to ProfileBookmark

Problems adding reCAPTCHA to my php script

Hi i’m added some code from google’s reCAPTCHA tool into my php script, my php worked before adding this new code but it doesn’t work now. I really want reCAPTCHA on my site so what is the problem with this code i presume the code is conflicting with eachother. The error message im getting is…

[B]Parse error: syntax error, unexpected $end in /home2/all05/public_html/verify.php on line 129[/B]

now line 129 is the last line…

[COLOR=”Blue”]<?php

require_once(‘recaptchalib.php’);

if ($_POST[’email’] != ”) {

$privatekey = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”;
$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 {

$EmailTo = “[email protected]“;
$Subject = “Contact From The Website”;
$full_name = Trim(stripslashes($_POST[‘full_name’]));
$email_address = Trim(stripslashes($_
POST[’email_address’]));
$tel_number = Trim(stripslashes($_POST[‘tel_number’]));

$validationOK=true;
if (Trim($full_name)==””) $validationOK=false;
if (Trim($email_address)==””) $validationOK=false;
if (Trim($tel_number)==””) $validationOK=false;

if (!$validationOK) {
print “<meta http-equiv=”refresh” content=”0;URL=goback.htm”>”;
exit;

}

$Body .= “n”;
$Body .= “Full Name: “;
$Body .= $full_name;
$Body .= “n”;
$Body .= ” “;
$Body .= “n”;
$Body .= “E-Mail Address: “;
$Body .= $email_address;
$Body .= “n”;
$Body .= ” “;
$Body .= “n”;
$Body .= “Telephone Number: “;
$Body .= $tel_number;

$success = email($EmailTo, $Subject, $Body, “From: <$email_address>”);

if ($success){
print “<meta http-equiv=”refresh” content=”0;URL=thanks.htm”>”;
}
else{
print “<meta http-equiv=”refresh” content=”0;URL=error.htm”>”;

} php?>[/COLOR]

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @stephenallden spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...