magicword - Magic word method for reducing comm...


This is about the simplest anti-comment-spam measure you can imagine, but it’s probably effective enough for all but the most popular blogs. Here’s how it works. You pick a question and put a field on your comment for for the answer to the question. If the user answers it correctly, his comment is accepted. Otherwise it’s rejected. Here’s how it works:


Requires the comments plugin.

This plugin comes with Pyblosxom. To install, do the following:

  1. Add Pyblosxom.plugins.magicword to the load_plugins list in your file.
  2. Configure as documented below.


Here’s an example of what to put in

py['mw_question'] = "What is the first word in this sentence?"
py['mw_answer'] = "what"

Note that mw_answer must be lowercase and without leading or trailing whitespace, even if you expect the user to enter capital letters. Their input will be lowercased and stripped before it is compared to mw_answer.

Here’s what you put in your comment-form file:

The Magic Word:<br />
<i>$(mw_question)</i><br />
<input maxlenth="32" name="magicword" size="50" type="text" /><br />

It’s important that the name of the input field is exactly “magicword”.

Security note

In order for this to be secure(ish) you need to protect your file. This is a good idea anyway!

If your file is in your web directory, protect it from being seen by creating or modifying a .htaccess file in the directory where lives with the following contents:

Order allow,deny
deny from all

This will prevent people from being able to view by browsing to it.


Plugin is distributed under license: MIT