http://www.kagami.org/diary/2007-04-30-1.html
仕込んだ。
簡単だこりゃ。
(1)kuttukibbs.confファイルの$page_template_defaultの
投稿ボタンの前あたりに計算式を追加
<div class="textarea">
コメント:<textarea name="body" cols="60" rows="5"></textarea>
</div>
+ <div class="arith"><br>
+ コメントスパム回避のため,以下の足し算の答えを半角でご記入下さい: <br>
+ $arith_x + $arith_y = <input class="field" name="arith" value="">
+ <input type="hidden" name="arith_x" value="$arith_x">
+ <input type="hidden" name="arith_y" value="$arith_y">
+ </div>
<div class="button">
<input type="submit" name="comment" value="投稿">
</div>
### 表示
for (my $i = $latest_id; $i >= 0; $i--) {
next unless defined $com_hash{$i};
$comments .= make_comment_html($com_hash{$i}, $i + 1);
}
+ ### スパム防止計算問題の種
+ my $arith_x = int(rand(9)) + 1;
+ my $arith_y = int(rand(9)) + 1;
### 書き込み
if ($mode eq "write") {
+ ### 計算の答え合わせ
+ my $arith = $q->param('arith');
+ my $arith_x = $q->param('arith_x');
+ my $arith_y = $q->param('arith_y');
+ if (!$arith || $arith != $arith_x + $arith_y) {
+ exit;
+ }
追記:[2007-05-28]時点で、順調に動いています。固定リンク [2007-05-22-3]
これまでの訪問者は 人です。