प्राप्त करना जारी रखें मैं अपनी साइट पर एक reCAPTCHA जोड़ने की कोशिश कर रहा हूं, लेकिन जब मैं उत्तर सबमिट करता हूं तो incorrect-captcha-sol
त्रुटि प्राप्त करना जारी रखें।reCAPTCHA के साथ मदद की ज़रूरत है - गलत-कैप्चा-सोल
क्या कोई मुझे बता सकता है कि क्या मैं निम्नलिखित करने में सही हूं?
मेरे पास एक सामान्य index.php है, जिसमें contact.php शामिल है। contact.php में मैं निम्नलिखित कोड डाला है:
require_once('recaptchalib.php');
$publickey = "XXXX";
$privatekey = "XXXX";
//the response from reCAPTCHA
$resp = null;
//the error code from reCAPTCHA, if any
$error = null;
if ($_POST['submit']) {
$message = $_POST['message_txt'];
$name = $_POST['name_txt'];
$email = $_POST['email_txt'];
$emailBody = $message;
$to = 'xx';
$from = $name.' <'.$email.'>';
$subject = 'XX Website Enquiry';
$headers = 'From: '.$from;
$resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
echo 'captcha correct';
if (mail($to,$subject,$emailBody,$headers)) {
//echo 'mail sent';
$confirmation = 'sent';
}
else {
//echo 'mail not sent';
$confirmation = 'error';
}
} else {
# set the error code so that we can display it. You could also use
# die ("reCAPTCHA failed"), but using the error message is
# more user friendly
$error = $resp->error;
echo $error;
}
}
मेरी एचटीएमएल में मैं इस तरह कॅप्चा डाला:
<form name="contactForm" method="post" action="index.php?id=contact&action=submit#contact">
<tr><td>Name</td><td><div align="right">
<input type="text" name="name_txt" class="input">
</div></td></tr>
<tr><td>Email</td><td><div align="right">
<input type="text" name="email_txt" class="input">
</div></td></tr>
<tr><td height="10"></td></tr>
<tr><td colspan="2">Message</td></tr>
<tr><td colspan="2"><textarea name="message_txt" class="textarea" style="width:200px; height:100px"></textarea></td></tr>
<tr><td colspan="2"><?php echo recaptcha_get_html($publickey, $error); ?></td></tr>
<tr><td colspan="2" style="padding-top:10px;"><input type="image" src="images/header_06.gif" name="submit" value="submit"></td></tr>
</form>
मैं नहीं देख सकता हूँ कि मैंने कुछ गलत कर रहा हूँ, लेकिन किसी भी रचनात्मक आलोचना की सराहना करेंगे।
TIA