ホーム > KAZ > MT4スパムコメント対策 「keystrokes」プラグイン
2009年6月 4日
MT4スパムコメント対策 「keystrokes」プラグイン (KAZ)
Movable Typeのスパムコメント対策のプラグインをご紹介します。
大変迷惑なスパムのコメントですが、そのほとんどが英語で大量に入ってきます。
どうやらこういったスパマーは直接コメント投稿用のCGIに直接アクセスしてくるようです。
そういったスパムコメントをやっつける素晴らしいプラグインがこちら。
「MT-Keystrokes」
http://overstated.net/projects/mt-keystrokes/
[参考にさせて頂いたサイト様]
http://senna330.com/archives/2008/04/000790.php
http://taeko.w-museum.com/wing/200702011212.html
[導入メモ]
1.上記サイトからプラグインをダウンロードして解凍。
「plugins/keystrokes.pl」 を修正します。
MTのバージョンを3から4に変更します。
【修正前】
return 1 unless $MT::VERSION =~ m(^3\.);
↓
【修正後】
return 1 unless $MT::VERSION =~ m(^4\.);
2.プラグインをMTにアップロード
「mt/plugins/keystrokes.pl」
「mt/php/plugins/function.MTKeystrokes.php」
3.テンプレートモジュールの「コメント入力フォーム」3箇所を以下の通り書き換えます。
【formタグの下に <$MTKeystrokes$> を挿入】
<form method="post" action="<$MTCGIPath$><$MTCommentScript$>" name="comments_form" id="comments-form" onsubmit="if (this.bakecookie.checked) rememberMe(this)">
<$MTKeystrokes$>
【コメント入力部分の<textarea>タグ内に onkeypress="keystrokes(this.form)" を挿入】
<textarea id="comment-text" name="text" rows="15" cols="50" onkeypress="keystrokes(this.form)">
【コメント投稿ボタンに onclick="keystrokes(this.form)" を挿入】
<input type="submit" accesskey="s" name="post" id="comment-submit" value="投稿" onclick="keystrokes(this.form)" />
4.修正したテンプレートを保存して再構築。
以上で作業完了です。
こうしておけば、ちゃんとコメントフォームで「投稿」ボタンを押さない限り、勝手にはコメント投稿できないという仕組み。
スパムに悩まされないよう必須の作業ですね!
| 個別ページ
- カレンダー
-
- 最新エントリー
- アーカイブ
- 検索
-
- モバイルサイト
-

- 上記バーコードをケータイで読み取ってアクセスしてください。ケータイの機種によってはご覧になれない場合もございます事、ご了承願います。



