私はこのウェブサイトwww.canuckssuck.orgを持っていますが、今週からスパムの投稿やコメントを受け取っています。私はあなたの視聴の喜びのためにそこに残しました. それらは常に最初のページにのみ表示されます。私の reCAPTCHA の実装に欠陥がありますか、それとも正当に無効にされていますか? これは完全にコード化された Web サイトを意図したものではありません。サイト全体は 1 ページのみです。
ここに私の投稿コードがあります:
# are we submitting the page?
if (isset($_POST['submit'])) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
//validate data kind of!
if($_POST['title'] == "")
{
$_POST['title'] = "The Canucks Suck";
}
if($_POST['comment'] == "")
{
$_POST['comment'] = "New Jersey is the best, we all know it!";
}
if($_POST['name'] == "")
{
$_POST['name'] = "Anonymous";
}
if($_POST['location'] == "")
{
$_POST['location'] = "Too embarrassed to disclose it.";
}
$ip = getUserIpAddr();
$_POST['location'] = $_POST['location'] +"--"+ $ip;
//convert line breaks to <br /> from /n etc
$br_comment = nl2br($_POST['comment']);
//add info to database
$obj->insert_values("INSERT INTO posts (post_id, title, comment, name, time, location) VALUES (NULL, '$_POST[title]', '$br_comment', '$_POST[name]', NULL, '$_POST[location]')");
header( 'Location: index.php?success=1' ) ;
//for debugging
echo "<h2 style=\"color:#00FF00; background:black; padding:2px;\">SUCCESSFULLY ADDED, THANKS!</h2>";
} else {
echo "<span style=\"color:red;\">Sorry cannot add comment because you've failed to provide correct captcha! Try again...</span><br />";
}
}
echo recaptcha_get_html($publickey, $error);
?>