友人が古い HTML コードを変更して、スパムが Web フォームから Coldfusion 関数に渡されるのを防ぐのを手伝おうとしています。基本的に、Web フォームは action=add_to_data.cfm を呼び出します。友人は、フォームを通過するスパムを削減するために recaptcha を統合したいと考えています。私はその部分を機能させ、reCaptcha 検証を完了しました。問題は、coldfusion の "add_to_data.cfm" アクションを呼び出してフォームのデータを渡す方法がわからないことです。フォームのデータを coldfusion に -- 「add_to_data.cfm.
元のフォーム:
<form method="post" action="add_to_data.CFm">
....blah, blah, blah ... form contents ...
<input type="submit" value="Please add to my Data />
<form>
ここで、Google 開発者の reCaptcha チュートリアルからのガイダンスに従って、「add_to_data.CFm」に直行するのではなく、reCaptcha を検証する方法を理解できる唯一の方法は、フォーム アクションを「add_to_data.CFm」から「 action」を新しく作成した「verify_recaptcha.php」に追加して、recaptcha を検証できるようにします。
<form method="post" action="verify_recaptcha.php">
...original form contents ...
<?php
require_once('recaptchalib.php');
$publickey = "your_public_key_goes_here";
echo recaptcha_get_html($publickey);
?>
<input type="submit" />
<form>
この例は、verify_recaptcha.php を使用した recpatcha 検証用の Google 開発者 Web ページから直接引用したものです。
<?php
require_once('recaptchalib.php');
$privatekey = "your_private_key_goes_here";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {
// Your code here to handle a successful verification
*** this is where I need gather he form outputs and call add_to_data.CFM
*** but HOW??
}
?>
私の質問は、「データ」をadd_to_data.CFmに送信する方法です??
上記の「else」セクション内で、次のようなフォーム変数を取得できることを知っています。
$name = $_POST['yourname'];
$email = $_POST['email'];
$data = $_POST['data'];
$comments = $_POST['comments'];
$formsub = $_POST['Submit'];
質問は次のとおりです。「add_to_data.CFM」へのフォーム送信アクションを完了するにはどうすればよいですか??
前もって感謝します