2009-08-12 3 views
8

내 사이트에 reCAPTCHA를 추가하려고하지만 대답을 제출할 때 계속 incorrect-captcha-sol 오류가 발생합니다.reCAPTCHA에 대한 도움이 필요합니다. - 잘못된 captcha-sol을 계속 받으십시오.

내가 다음을 수행하는 데 올바른지 아무에게도 알 수 있습니까?

나는 일반적인 index.php가 있는데 여기에는 contact.php가 포함되어 있습니다. ,

<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> 

는 내가 뭔가 잘못을하고있는 중이 야 볼 수 없습니다 내 HTML에서

내가 이런 보안 문자를 삽입

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; 
} 

} : contact.php에서 다음 코드를 삽입 한 그러나 어떤 건설적인 비판도 감사 할 것이다. TIA

답변

19

, 그것이 내가 건너 온 가장 이상한 것들 중 하나입니다에서입니다, 내 구문은 이전이었다

<table> 
<form> 
<tr><td></td></tr> 
</form> 
</table> 

나는 그것을 변경 이 스위치는 및 recaptcha_challenge_field이 값을 양식에 다시 게시하고 있습니다.

모든 MY 양식 변수가 전환되기 전에 다시 게시 되었기 때문에이 이유를 알 수 없습니다.

감사합니다.

7

두 번 검사를 게시하는 경우 - 예를 들어, 한 번 자바 스크립트에서 한 번 두 번째는 API로 실패합니다 PHP를 통해 단지 솔루션을 한 번 유효한 반환 할 수 있습니다. 도움이

희망, 조쉬

0

당신은 당신이 올바른 단어를 입력하고 있는지 있습니까?

이 하나가 내가 이것을 해결 한 recaptcha website :

Line 1  "true" or "false". True if the reCAPTCHA was successful 
Line 2 if Line 1 is false, then this string will be an error code. reCAPTCHA can 
    display the error to the user (through the error parameter of api.recaptcha.net/challenge). 
    Implementations should not depend on error code names, 
as they may change in the future. 


    Example: If your response looks like this: 

    false 
    **incorrect-captcha-sol** 

    ... you can add '&error=incorrect-captcha-sol' to the challenge request URL, 
and the user will get an error code. 
5

양식이 tr의 외부에있을 수 없기 때문에 ..... 테이블의 outisde에 있어야합니다 ..... 양식을 테이블에 삽입 할 수 없지만 삽입 할 수 있습니다. .

방법 = "POST"를

건배 : 내 경우

2

는 오류가 지정하지 않고 양식을 설정하는 것이 었습니다!

관련 문제