PHP Captcha Error help - replace the "die" command
Posted on
16th Feb 2014 07:03 pm by
admin
Hi All,
I am after a bit of help with a Captcha spam protection box.
Did you know?Explore Trending and Topic pages for more stories like this.
The site gave me instructions, and all is well, apart from if the user give the wrong Captcha information...
The highlighted code is the part where i would like help, i would like the error message to appear in the same area/under submit button, in the form. For example: "*Wrong input for Captcha ", not take the user to a new screen, and make them hit the back button.
ANY help would be greatly appreciated, as im very new to PHP and not really sure whats what.
The code is:
***** PLEASE THE CODE TAG WHEN POSTING SOURCE CODE *****Line number On/Off | Expand/Contract<?phprequire_once('recaptchalib.php');$privatekey = "************************";$resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); [color=#0000FF]if (!$resp->is_valid) { die ("The reCAPTCHA wasn't entered correctly. Please go BACK and try again..." . "(reCAPTCHA said: " . $resp->error . ")");}[/color] $to = "grant@********";$subject = "Enquiry";$name = $_REQUEST['name'] ;$phone = $_REQUEST['phone'] ;$email = $_REQUEST['email'] ;$message = $_REQUEST['message'] ;$headers = "From: $email";$body = "Enquiry From: $name.nn$name's Phone Number: $phone.nnEnquiry:n$message";$sent = mail($to, $subject, $body, $headers) ;if($sent){header( 'Location:******** TEST_ENVIRONMENT/Tatar/thank_you.php' ) ;}else{print "We encountered an error sending your enquiry"; }?>
Thank you in advance
No comments posted yet
Your Answer:
Login to answer
233
45
Other forums
Combining refCursors and Summing
Given the following DDL:
CREATE TABLE FOODSALESTEST
("WEEKNBR" NUMBER,
"ST
Downloading file (Headers)
I'm trying to make users download a file, but they must wait 60 seconds before it begins.
But
Database connection failure
Hello All,
I am trying to create new connection to Oracle DB 10.1,
I could not see a
Optimize Code
Just started getting into the use of cookies. The following code will redirect users to a set URL s
php forms and database navigatio
Hello,
I'm new to php and i'd like to post the following.
I have written code to get records f
Variable Clash
In the past I've had variables clash. For example:
Code: <?php
$c = 5;
$ca
Code clarification
Hi
In the following code what could be the "search_print()" and where it could be
upgrade from 4.7 to ECC 6.0
Hi all,
we are going to do an upgrade from R/3 4.7 to ECC 6.0. I need to know if i can find som
radio button reamains checked
Hello i'm trying to keep the state off my radio buttons so it shows which ones where clicked after t
Greek characters in php
Hi,
I'm making a script and I m using for first time greek characters.
I started to write