2009-07-15 4 views
0

自分のフォームにキャプチャを実装しましたが、検証していないようです。私はレイアウトに明白なものがあるかどうか、それをどうやって変更できるかを知るために、以下のコードを追加しました。投稿の公開鍵と秘密鍵が削除されました。Captcha自分のフォームを破る?

ありがとうございました。

<h1>Contact</h1> 
<form action="index.php" method="post"> 
<input type="hidden" name="required_fields" value="name, email, message" /> 
<input type="hidden" name="email_fields" value="email" /> 
<input type="hidden" name="html_template" value="form.tpl.html" /> 
<input type="hidden" name="mail_template" value="mail.tpl.txt" /> 
<input type="hidden" name="thanks" value="/thanks.php" /> 
<!-- <input type="hidden" name="error_page" value="./docu/error.html" /> --> 
<table border="0" cellpadding="3" cellspacing="0"> 
<tr> 
    <td><p>Full Name <span>*</span></p></td> 
    <td>&nbsp;&nbsp;&nbsp;</td> 
    <td><input type="text" name="name" value="" size="40" /></td> 
</tr> 
<tr valign="bottom"> 
    <td><p>Phone</p></td> 
    <td>&nbsp;&nbsp;&nbsp;</td> 
    <td><input type="text" name="phone" value="" size="40" /> 
    </td> 
</tr> 
<tr valign="bottom"> 
    <td><p>Email <span>*</span></p></td> 
    <td>&nbsp;&nbsp;&nbsp;</td> 
    <td><input type="text" name="email" value="" size="40" /> 
    </td> 
</tr> 
<tr valign="top"> 
    <td><p>Message <span>*</span></p></td> 
    <td>&nbsp;&nbsp;&nbsp;</td> 
    <td><textarea name="message" cols="30" rows="10"></textarea></td> 
</tr> 
<tr valign="top"> 
    <td>&nbsp;</td> 
    <td>&nbsp;&nbsp;&nbsp;</td> 
    <td><p> 

<?php 

require_once('recaptchalib.php'); 

// Get a key from http://recaptcha.net/api/getkey 
$publickey = ""; 
$privatekey = ""; 

# the response from reCAPTCHA 
$resp = null; 
# the error code from reCAPTCHA, if any 
$error = null; 

# was there a reCAPTCHA response? 
if ($_POST["recaptcha_response_field"]) { 
    $resp = recaptcha_check_answer ($privatekey, 
            $_SERVER["REMOTE_ADDR"], 
            $_POST["recaptcha_challenge_field"], 
            $_POST["recaptcha_response_field"]); 

    if ($resp->is_valid) { 
      echo "You got it!"; 
    } else { 
      # set the error code so that we can display it 
      $error = $resp->error; 
    } 
} 
echo recaptcha_get_html($publickey, $error); 
?> 
     <input type="submit" name="send" value="Send" /> 
     <br /> 
     <span>*</span> = required field.</p></td> 
</tr> 
</table> 
</form> 
+0

あなたはそれを見ませんでしたか?もっと凝視!それは今、そこにあります... –

+0

あなたはどんなエラーがありますか? – Greg

+0

さて、実際にはフォームを一杯にしなくても送信ボタンを押すだけでページをリセットできます。 –

答えて

1

私はこのcaptchaの実装の詳細を知らないので、あなたのcaptchaに何が問題なのかを言うことはできません。

投稿されたデータのフィールドには入力しないため、フォームがリセットされます。おそらく、あなたは意図していません。

まず、問題がキャプチャにあることを確認するために、キャプチャがなくてもフォームが正常に動作することを確認してください。

関連する問題