Please see Blocklist2? for an updated and expanded version of this file.


How can I block wiki spammers from using my site in a vain, futile attempt to increase their Google pagerank?


The Attach:blocklist.php script allows the creation of a list of words and IP addresses to be blocked from posts to the site. To use the script, simply copy it into the cookbook/ directory and then add the line

    if ($action=='edit') include_once('cookbook/blocklist.php');

to the local/config.php file.

When activated, blocklist.php scans the Main.Blocklist page looking for strings of the form block:something where something is a sequence of characters to be excluded from posting. Thus, would prevent any edits containing "".

In addition, the Main.Blocklist? page can contain IP addresses or ranges of the form a.b.c.d or a.b.c.*; any postings from a listed address are also blocked.

In general the administrator will also want to edit-protect the Main.Blocklist page to prevent arbitrary additions/deletions from the blocklist (see PmWiki.Passwords). It's also possible to read-protect the Main.Blocklist page so that others do not know the exact phrases and/or IP addresses that are being blocked.

Other notes

The blocklist.php script also sets the variable $Blocklisted, so that an administrator can perform other actions beyond simply disallowing a post.

And this script could also be used on pmwiki-v1. (Elias Soong has tested it on Pmwiki 1.0.5)


Create a NewPageName for every public group that you have and password protect it's edit and attribute credentials. Most wikispam tools test if they can create or modify this page first prior to going any further. This would block out most spammer-scripts by default.


  • Pm, 29-Nov-2004

See Also

Category: Administration, Security