reCAPTCHA validation problem. Somehow "Verify.php" doesnt validate the form.

719 views
Skip to first unread message

WRobN

unread,
Apr 5, 2010, 12:38:15 PM4/5/10
to reCAPTCHA
I get reCapthca to show in the form. But somehow it doesnt validate
the form...
All PHP is in the same folder.

It accepts ALL text that is entered in the field...
Can someone explain why it accepts all input?

Integrated in Table (there are more fields in the table):

<form method="post" action="verify.php">
<?php
require_once('recaptchalib.php');
$publickey = "My key";
echo recaptcha_get_html($publickey);
?>
</form>


___________________________________________________________________________

Verify.php:

<?php
require_once('recaptchalib.php');
$privatekey = "MyKey";
$response = 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
}
?>

Paul Herring

unread,
Apr 5, 2010, 2:03:44 PM4/5/10
to reca...@googlegroups.com
On Mon, Apr 5, 2010 at 5:38 PM, WRobN <wro...@gmail.com> wrote:

> Verify.php:
>
>  <?php
>  require_once('recaptchalib.php');
>  $privatekey = "MyKey";
>  $response = 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

echo "<pre>\n";
print_r($_POST);
print_r($_SERVER); // ensure at least some extra output
echo "</pre>";

>  }
>  ?>

What (extra) text gets printed?

--
PJH

http://shabbleland.myminicity.com/tra
http://www.chavgangs.com/register.php?referer=9375

WRobN

unread,
Apr 5, 2010, 2:58:38 PM4/5/10
to reCAPTCHA
If i execute verify.php straight away to directly cause a error, i get
this text:

The reCAPTCHA wasn't entered correctly. Go back and try it again.

(reCAPTCHA said: )

But if i fill in the form it will accept wrong text. Or empty.

My form is build up in form.php, the mailer script is in
formmailer.php the reCaptcha validator lies in verify.php.

Can it be that the formmailer.php wich controls spam protection and
other validations, sends the mail without needing reCAPTCHA to
validate?

I use formmailer from: http://www.dbmasters.net/node/18

It works without the reCAP.

I only wanted to use real reCAP instead of "sort of reCAP" from
dbmasters.

Can this script bypass reCAP?

If i integrate Verify.php into the formmailer.php ( i put the verify
in top of formmailer)
And change the link from Verify to formmailer it ALWAYS gives a error
as if the text is entered wrong.

WRobN

unread,
Apr 5, 2010, 3:01:30 PM4/5/10
to reCAPTCHA
damn it i just typed a complete post pressed submit and nothing....

I will awnser tomorrow im no mad about this stupid thing.

I even couldnt go back and repost it all is gone,....

WRobN

unread,
Apr 5, 2010, 3:03:03 PM4/5/10
to reCAPTCHA
oh its posted....
weird time delay, i pressed ctrl+f5 to refresh but it was still not
posted...

Charles Sweeney

unread,
Apr 5, 2010, 5:39:48 PM4/5/10
to reCAPTCHA
WRobN wrote:
> oh its posted....
> weird time delay, i pressed ctrl+f5 to refresh but it was still not
> posted...

Can't you ask the author of the script?

--
Charles Sweeney
http://FormToEmail.com
PHP mail script with reCAPTCHA

WRobN

unread,
Apr 5, 2010, 6:40:04 PM4/5/10
to reCAPTCHA
I did a simple test to look if reCAPTCHA works.
These following 2 PHP files; "form" and "verify" should work but dont.
The reCap img shows but the verification goes wrong.
It always result in this text:

The reCAPTCHA wasn't entered correctly. Go back and try it again.

(reCAPTCHA said: )

This is my php test form (only recaptcha);

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>


<form method="post" action="verify.php">
<?php
require_once('recaptchalib.php');

$publickey = "xXxXxXxXxXxXxXxXx";
echo recaptcha_get_html($publickey);
?>
</form>
</body>
</html>

_____________________________________________


And this the verify.php :

<?php
require_once('recaptchalib.php');
$privatekey = "xXxXxXxXxXxXxXxXx";


$response = 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 . ")");
}

?>

__________________________________________________________


I asked the author of the mail form to implement reCAPTCHA himself
into the form.
I got the form working, but the problem is reCAPTCHA.

The problem are the 2 php files above. They wont work and i dont know
why.
Its the basic code from the reCAP site.

It should work but it doesnt.

HELP!

WRobN

unread,
Apr 5, 2010, 8:10:52 PM4/5/10
to reCAPTCHA
My site: http://www.wientjesvoegwerk.nl/index.html

You see the form in Contact section. It all works exept reCaptcha.
Without the check it works and sends mail.

My test showed the form is ok and the validation of reCAPTCHA goes
wrong.

WRobN

unread,
Apr 7, 2010, 1:34:23 PM4/7/10
to reCAPTCHA
SOLVED!

It was a stupid misstake in verify.php.
"resp" needs to be "response" in the script.

Reply all
Reply to author
Forward
0 new messages