How do I go about changing it to redirect to a page on my site if the
the captcha words are incorrect.
Im using the form method (Pub & Priv Keys Hidden).
In my html file I have the following:
<form action="contact.php" method="post" name="ContactForm">
<label>Name:
<input name="name" type="text" size="30" />
</label>
<label>Email:
<input name="email" type="text" size="41" />
</label><br /><br />
<label>Your Message:<br />
<textarea name="comments" cols="90" rows="5"></textarea>
</label><br /><br />
<script type="text/javascript"
src="http://api.recaptcha.net/challenge?k=MYPUBCODE">
</script>
<noscript>
<iframe src="http://api.recaptcha.net/noscript?k=MYPUBCODE"
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><br />
<input name="submit" type="Submit" value="Submit" />
<br />
</form>
In my PHP file, the following (related to recaptcha):
require_once('recaptchalib.php');
$privatekey = "MYPRIVCODE ";
$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 . ")");
}
Using standard recaptchalib.php
---
So I think its something to do with
die ("The reCAPTCHA wasn't entered correctly. Go back and try it
again." .
"(reCAPTCHA said: " . $resp->error . ")");
I just need to figure how to make it forward to a page called "contact-
fail.html" rather than display the message
Any help greatly appreciated.
If you haven't printed anything by that point, you can use header():
<http://php.net/manual/en/function.header.php> instead of die();
--
PJH
http://shabbleland.myminicity.com/env
http://www.chavgangs.com/register.php?referer=9375
header("Location: http://www.example.com/"); /* Redirect browser */
/* Make sure that code below does not get executed when we redirect.
*/
exit;
Add the following header line pointing to a error page:
if (!$resp->is_valid) {
header('Location:
http://www.mysite/error.php');
die();
}
Using standard recaptchalib.php
---
Any help greatly appreciated.
--
You received this message because you are subscribed to the Google Groups
"reCAPTCHA" group.
To post to this group, send email to reca...@googlegroups.com.
To unsubscribe from this group, send email to
recaptcha+...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/recaptcha?hl=en.