1 (edited by 505 2006-05-26 19:51)

Topic: Forbidden word spam blocker 1.0.0

##
##
##        Mod title:  Forbidden word spam blocker
##
##      Mod version:  1.0.0
##   Works on PunBB:  1.2.x
##     Release date:  2006-05-26
##           Author:  Daniel Vijge <vijge@dse.nl>
##
##      Description:  This mod allows forum administrators and moderators
##                    to forbid certain words to be in a post. When such a
##                    is used in a post a warning is displayed and the message
##                    cannot be posted until that word is removed.
##                    This can be used to stop spam bots from posting on
##                    your forum. Just set part of the message they post
##                    as a forbidden word.
##
##   Affected files:  post.php
##                    lang/English/post.php
##                    lang/[...]/post.php (when more languages are installed)
##
##       Affects DB:  Yes
##
##            Notes:  1) To add a spam word, go to the forum administration page
##                    and click on 'Spam word'. This page is available for
##                    both administrators and moderators
##                    2) Be carefull what words you block. For example, if you
##                    block 'foo', users can't post message containing 'foobar'.
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##

Download here

Simple protection against spam bots, by blocking certain words. I made it quite quickly because I needed something to stop spam bots. I haven't done a lot of testing, but it works safe on my install. Also, the documentation is not that good, but it should be enough for you to get it installed.
If you have any comments, please share them.

Re: Forbidden word spam blocker 1.0.0

I just tried installing this mod, and I got an error when running mod_install.php:

Sorry, this mod currently supports MySQL only!

I'm running my PunBB forum with a MySQL database, so I don't understand why it won't install the table.  I've looked at the code, but I can't find the problem.

Any ideas on what to change in order to get this working?

Re: Forbidden word spam blocker 1.0.0

dhdesign (and 505): Open up mod_install.php and look for:

case 'mysql':

After that, insert:

case 'mysqli':

And you should be fine.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Forbidden word spam blocker 1.0.0

Rickard -

I did what you suggested, but I'm getting the same error. Here's the code from mod_install.php - lines 31 thru 35:

        case 'mysql':
        case 'mysqli':
            $db->query("CREATE TABLE ".$db->prefix."`spamwords` (`id` INT( 11 ) NOT NULL AUTO_INCREMENT ,`word` TEXT NOT NULL ,PRIMARY KEY ( `id` )) TYPE = MYISAM", __FILE__, __LINE__, $db->error());
        default:
            message('Sorry, this mod currently supports MySQL only!');

Any other ideas? I'd really like to get this mod working.

Re: Forbidden word spam blocker 1.0.0

What is $db_type listed as in your config.php file?

6 (edited by dhdesign 2006-09-04 23:38)

Re: Forbidden word spam blocker 1.0.0

From my config.php file:

$db_type = 'mysql';

EDIT:  Could I just create the table manually using phpMyAdmin?

Re: Forbidden word spam blocker 1.0.0

Okay, I went ahead and created the database table manually (via phpMyAdmin), using the following SQL statement:

CREATE TABLE `punbb_spamwords` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`word` TEXT NOT NULL,
PRIMARY KEY (`id`)
) TYPE = MYISAM;

I continued on with the installation instructions included in the readme.txt file, editing post.php and lang/english/post.php, then uploading them to the server.  Entered a few spam words thru the Admin section, then off to do a test post to see if this works.  It does work! smile  The error message came up stating that a certain word had to be removed from the post before it could be submitted.

The mod_install.php file needs to be fixed though, so that others can get this installed without issues.

Re: Forbidden word spam blocker 1.0.0

ah

The switch statement in install_mod.php should be

switch ($db_type)
{
        case 'mysql':
        case 'mysqli':
            $db->query("CREATE TABLE ".$db->prefix."`spamwords` (`id` INT( 11 ) NOT NULL AUTO_INCREMENT ,`word` TEXT NOT NULL ,PRIMARY KEY ( `id` )) TYPE = MYISAM", __FILE__, __LINE__, $db->error());
            break;

        default:
            message('Sorry, this mod currently supports MySQL only!');
            break;
}