The url I am using to work out the kinks is:
hillsidemedicalbilling.com/test/
So far I have done the steps outlined in the "Displaying reCAPTCHA
Without Plugins" section using "The Standard Challenge and Non-
JavaScript API" method.
It appears that the given html of
<script type="text/javascript"
src="http://www.google.com/recaptcha/api/challenge?
k=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx">
</script>
<noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?
k=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
height="300" width="500" frameborder="0"></iframe><br>
<textarea name="recaptcha_challenge_field" rows="3" cols="40">
</textarea>
<input type="hidden" name="recaptcha_response_field"
value="manual_challenge">
</noscript>
should be
........................................................................</
iframe><br />
..........................................................................................
<input type="hidden" name="recaptcha_response_field"
value="manual_challenge" />
</noscript>
so I have changed that.
I then placed this script in my header to change it to the appropriate
color scheme:
<script type="text/javascript">
var RecaptchaOptions = {
theme : 'white'
};
</script>
I placed recaptchalib.php in the /test/ directory as instructed.
I created the verify.php file using the script below (this is the
entire verify.php file):
1 <?php
2 require_once('recaptchalib.php');
3 $privatekey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
4
5 if ($_POST["recaptcha_response_field"]) {
6 $response = recaptcha_check_answer (
7 $privatekey, $_SERVER["REMOTE_ADDR"],
8 $_POST["recaptcha_challenge_field"],
9 $_POST["recaptcha_response_field"]);
10
11 if ($response->is_valid) {
12 $show_web_form = 0;
13
14 // Begin: GoDaddy "gdform.php"
15 $request_method = $_SERVER["REQUEST_METHOD"];
16
17 if ($requ.uest_method == "GET"){
18 $query_vars = $_GET;
19 } elseif ($request_method == "POST"){
20 $query_vars = $_POST;
21 }
22
23 reset($query_vars);
24 $t = date("U");
25
26 $file = $_SERVER['DOCUMENT_ROOT'] . "/../data/
gdform_" . $t;
27 $fp = fopen($file,"w");
28 while (list ($key, $val) = each ($query_vars)) {
29 fputs($fp,"<GDFORM_VARIABLE NAME=$key START>
\n");
30 fputs($fp,"$val\n");
31 fputs($fp,"<GDFORM_VARIABLE NAME=$key END>
\n");
32 if ($key == "redirect") { $landing_page =
$val; }
33 }
34
35 fclose($fp);
36 if ($landing_page != ""){
37 header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
38 } else {
39 header("Location: http://".$_SERVER["HTTP_HOST"]."/");
40 }
41 // End: GoDaddy "gdform.php"
42 } else {
43 died ("The reCAPTCHA was not entered correctly. Please go
back and try it again." .
44 "(reCAPTCHA said: " . $resp->error . ")");
I also linked it to the main index.html in the contact page like
this...
<form style="margin-left: 165px; left" action="verify.php"
method="post">
reCAPTCHA is displaying perfectly but I am getting the following error
on a new page when the "Submit" button is pressed.
Parse error: syntax error, unexpected $end in D:\Hosting\8502247\html
\test\verify.php on line 44
My goal is to have an incorrectly entered CAPTCHA display the error
"The reCAPTCHA was not entered correctly. Please go back and try it
again"
A successful submission should send the form contents to the gdform
(godaddy's method of email and a requirement for their email services)
and take the user to the url:
hillsidemedicalbilling.com/thankyou/
I hope someone can help me figure out what the issue is b/c I would
really like to come to a finishing point on this project.
Thanks in advance!
this is the
entire verify.php file):
1 <?php
[...]
42 } else {
43 died ("The reCAPTCHA was not entered correctly. Please go
back and try it again." .
44 "(reCAPTCHA said: " . $resp->error . ")");
[...]
reCAPTCHA is displaying perfectly but I am getting the following error
on a new page when the "Submit" button is pressed.
Parse error: syntax error, unexpected $end in D:\Hosting\8502247\html
\test\verify.php on line 44
I corrected those issues you mentioned above and it got rid of the
line 44 error.
Now I'm getting 4 other errors that keep repeating. I have tried to
read up on the syntax of the if/else statements and cant figure out
why it is not working. It looks to me that everything should be
working.
Can anyone help me figure this out? Here is the new code in its
entirety:
<?php
require_once('recaptchalib.php');
$privatekey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
if ($_POST["recaptcha_response_field"]) {
$response = recaptcha_check_answer (
$privatekey, $_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($response->is_valid) {
$show_web_form = 0;
// Begin: GoDaddy "gdform.php"
$request_method = $_SERVER["REQUEST_METHOD"];
if ($requ.uest_method == "GET"){
$query_vars = $_GET;
} elseif ($request_method == "POST"){
$query_vars = $_POST;
}
reset($query_vars);
$t = date("U");
$file = $_SERVER['DOCUMENT_ROOT'] . "/../data/
gdform_" . $t;
$fp = fopen($file,"w");
while (list ($key, $val) = each ($query_vars)) {
fputs($fp,"<GDFORM_VARIABLE NAME=$key START>
\n");
fputs($fp,"$val\n");
fputs($fp,"<GDFORM_VARIABLE NAME=$key END>
\n");
if ($key == "redirect") { $landing_page =
$val; }
}
fclose($fp);
if ($landing_page != ""){
header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
} else {
header("Location: http://".$_SERVER["HTTP_HOST"]."/");
}
// End: GoDaddy "gdform.php"
} else {
die ("The reCAPTCHA was not entered correctly. Please go back
and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
}
}
?>
Now I'm getting 4 other errors that keep repeating.
if ($requ.uest_method == "GET"){
$query_vars = $_GET;
} elseif ($request_method == "POST"){
$query_vars = $_POST;
}
Here are all the errors I am getting.
Warning: fopen(D:\Hosting\8502247\html/../data/gdform_1323381692)
[function.fopen]: failed to open stream: No such file or directory in
D:\Hosting\8502247\html\test\verify.php on line 27
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 29
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 30
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 31
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 29
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 30
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 31
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 29
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 30
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 31
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 29
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 30
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 31
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 29
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 30
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 31
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 29
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 30
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 31
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 29
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 30
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 31
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 29
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 30
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 31
Warning: fclose(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 35
Warning: Cannot modify header information - headers already sent by
(output started at D:\Hosting\8502247\html\test\verify.php:35) in D:
\Hosting\8502247\html\test\verify.php on line 39
Warning: fopen(D:\Hosting\8502247\html/../data/gdform_1323381692)
[function.fopen]: failed to open stream: No such file or directory in
D:\Hosting\8502247\html\test\verify.php on line 27
Warning: fputs(): supplied argument is not a valid stream resource in
D:\Hosting\8502247\html\test\verify.php on line 29
[snip]
Warning: Cannot modify header information - headers already sent by
(output started at D:\Hosting\8502247\html\test\verify.php:35) in D:
\Hosting\8502247\html\test\verify.php on line 39