当前,无论在验证码文本字段中键入什么,它都不会验证。它总是给我输入新单词。
我想这是因为我需要测试用户是否输入了正确的验证码答案。我需要发一封邮件请求。
如果能得到任何帮助,我将不胜感激。
这是我的密码:
$(document).ready(function(){
$('#fhjoinForm').submit(function(e) {
register();
e.preventDefault();
});
});
function register()
{
hideshow('loading',1);
error(0);
$.ajax({
type: "POST",
url: "submit.php",
data: $('#fhjoinForm').serialize(),
dataType: "json",
success: function(msg){
if(parseInt(msg.status)==1)
{
Recaptcha.create("pub key xxxxxxxxxxx",
"recaptcha_div",
{
theme: "clean",
callback: function(){
// what to do on success
window.location=msg.txt;
}
}
);
}
else if(parseInt(msg.status)==0)
{
error(1,msg.txt);
}
hideshow('loading',0);
}
});
}
function hideshow(el,act)
{
if(act) $('#'+el).css('visibility','visible');
else $('#'+el).css('visibility','hidden');
}
function error(act,txt)
{
hideshow('error',act);
if(txt) $('#error').html(txt);
}
这是我的邮寄申请
<?php
require_once('recaptchalib.php');
$publickey = "pub key hidden"; // you got this from the signup page
$privatekey = "priv key hidden";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
?>success<?
}
else
{
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
}
?>