[01/12/06] Spam Words

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
52
76%
Very Good
9
13%
Good
4
6%
Fair
0
No votes
Poor
3
4%
 
Total votes: 68

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati » Sun Dec 31, 2006 8:28 am

Impossible to say what can be the cause. Flawed installation, configuration not customized to your needs etc, etc.
Image

Jim Barber
Registered User
Posts: 6
Joined: Sun Dec 31, 2006 1:33 pm

Post by Jim Barber » Sun Dec 31, 2006 1:49 pm

Terrific Mod, Thanks JOE!

I installed it with easyMOD on two boards and installation went flawlessly.

I do have the time travel error but found that if after I delete flagged posts and I go back to the forum they were in and post a simple test reply, then everything is returned to normal. I then delete my test reply. Last post, poster, and time then show correctly on main page.

Thanks again!
Image

SkillinBizkit
Registered User
Posts: 41
Joined: Thu Dec 07, 2006 3:30 am

Post by SkillinBizkit » Sun Dec 31, 2006 4:43 pm

Hey, no prob, forgot that i had admin setting to use spam words :D

Excellent mod mate ;)

Six Sigma Teacher
Registered User
Posts: 22
Joined: Thu May 26, 2005 6:48 pm
Contact:

Post by Six Sigma Teacher » Sun Dec 31, 2006 8:32 pm

SkillinBizkit wrote: Hi. All installed, ACP spamwords can be accessed and words can be added, but when the word comes up in a topic, nothing happens??

Please help


Make sure you have enabled the filter in the Configuration in the Control Panel (Select "No" for "Disable Spam words filter"). IIRC, it is installed with the default to "Yes"

Edit: Never mind - you figured it out! :D

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati » Mon Jan 01, 2007 7:58 am

Jim Barber wrote: I do have the time travel error
Have you tried remidying the problem as described two pages back..? I'd be interested to see if that will work out for you, as - seemingly - another user only has intermittent success with the fix. Please let me know how you get on.

Sincerely,
Joe
Image

plasmatic
Registered User
Posts: 14
Joined: Tue Dec 12, 2006 3:34 am

Post by plasmatic » Sat Jan 06, 2007 12:27 pm

Alain13 wrote: Hello,
Excuse me my bad english
I have just installed the MOD spam words and all is ok
but when I want to use the option log ( h**p://www.mysite.net/forum/admin/admin_spamwords_log.php?sid=.......... ) I obtain a white page
I checked my installation several times
Can you help me
Thank you

I had this same problem. My site was displaying a string of error messages, the error log was a few pages of this:

Code: Select all

[06-Jan-2007 06:39:11] PHP Warning:  preg_replace() [<a href='function.preg-replace'>function.preg-replace</a>]: Compilation failed: missing terminating ] for character class at offset 12 in /home/annihila/public_html/forum/admin/admin_spamwords_log.php on line 241
[06-Jan-2007 06:39:11] PHP Warning:  preg_replace() [<a href='function.preg-replace'>function.preg-replace</a>]: Compilation failed: missing terminating ] for character class at offset 8 in /home/annihila/public_html/forum/admin/admin_spamwords_log.php on line 241
In the /admin/admin_spamwords_log.php file around line 236 I replaced

Code: Select all

	$message = $log_row[$i]['log_message'];

	for($j = 0; $j < count($spamwords); $j++)
	{
	    $spamword = str_replace('*', '', $spamwords[$j]);
		$message = preg_replace("#$spamword#is", '<span style="color: red; font-weight: bold;">' . $spamword . '</span>', $message);
	}
with this from an earlier version:

Code: Select all

	$message = $log_row[$i]['log_message'];
	$message = preg_replace("/\[.*?:$bbcode_uid:?.*?\]/si", '', $message);
	$message = preg_replace('/\[url\]|\[\/url\]/si', '', $message);

	/**
	 * Split the message into single words and highlight the offending words
	 */
	$single_words = explode(' ', $message);
	$words = '';
	for ($j = 0; $j < count($single_words); $j++)
	{
		$words .= (in_array($single_words[$j], $spamwords)) ? '<span style="color: red; font-weight: bold;">' . $single_words[$j] . '</span>' : $single_words[$j];
		$words .= ' ';
	}

	$message = $words;
The error log page now works. Kudos on the rest of the code, I have 10 pages of pissed off bot operators.. ;)

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati » Sat Jan 06, 2007 12:33 pm

OK, I see what's going on. Thanks for posting the error message. A small code rewrite needs doing, but in the meantime replacing

Code: Select all

      $message = preg_replace("#$spamword#is", '<span style="color: red; font-weight: bold;">' . $spamword . '</span>', $message);
WITH

Code: Select all

      $message = @preg_replace("#$spamword#is", '<span style="color: red; font-weight: bold;">' . $spamword . '</span>', $message);
should do.
Image

plasmatic
Registered User
Posts: 14
Joined: Tue Dec 12, 2006 3:34 am

Post by plasmatic » Sat Jan 06, 2007 2:24 pm

Whoa, fast response!
That clears up the errors, but leaves the message field blank.

I've had 18 bot attempts today by the way. I photo choped this and made it part of the error message...
Image

fpbear
Registered User
Posts: 17
Joined: Sun Sep 17, 2006 10:12 pm

Post by fpbear » Sun Jan 07, 2007 5:51 am

Mass import does not appear to work. Whenever a word includes a character that is interpreted by regex.. @ . etc.. the mass importer chops the word and the whole list is messed up. Any ideas how to import mass lists of words that contain characters other than abcdef...?

Joe Belmaati
Registered User
Posts: 2110
Joined: Sun Sep 28, 2003 7:35 pm
Location: Denmark

Post by Joe Belmaati » Sun Jan 07, 2007 7:03 am

OPEN

admin_spamwords.php

FIND

Code: Select all

			$list = preg_split("#[^A-Za-z-\*]#", $HTTP_POST_VARS['massad']);
REPLACE WITH

Code: Select all

			$list = preg_split("#[^A-Za-z-\*@]#", $HTTP_POST_VARS['massad']);
..basically, just add all the characters that you don't want to act as a delimiter for a new word/entry. Beware that the regex special characters need to be backslash escaped. Do a google search to find the special characters...
Image

eadz
Registered User
Posts: 15
Joined: Fri Jan 31, 2003 10:52 am

Akismet support

Post by eadz » Sun Jan 07, 2007 8:50 am

Joe, Thanks for the great mod. I have been using it on one of my forums with success, however the banned words list is getting bigger and bigger and harder to manage.

Have you heard of Akismet? ( www.Akismet.com ). It is a spam filtering service that was developed by the Wordpress guys but can be used for forums to detect spam. There was a Akismet mod, but it was abandoned, and I'm guessing one of the reasons is it is a lot of work to write the queueing code for spam messages.

The good news is you have already written that code! I have modified your mod to include Akismet support, and it was very very easy, just adding in an Akismet API call in the check_spam() function in spamwords.php.

I do not have the time or energy to write and support a mod, but I think it would be a nice addition to your mod if you could integrate my changes ( or something similar ) plus a setting to turn akismet on or off in the CP, and another setting for the Akismet API key.

I have written up my howto mod HPBB Spam Words to add Akismet support at my blog.

I have it working on one of my forums but at this stage my code is a rough draft, but very simple as it's just calling the Akismet library which returns a true or false if it's spam.

20
Registered User
Posts: 87
Joined: Sun Mar 19, 2006 12:27 pm

Post by 20 » Sun Jan 07, 2007 12:27 pm

This is a great mod. i've set it to show the error message instead of flagging the post, as i think they'll unlikely to be any false positives.

Is there a way so I can show the error message & the post doesn't get deleted and flag the post so I can see it's been caught from within the acp.

Sorry, if this has already been asked, can you add bbcode to the spamword list to prevent users entering [/url]

jerryT
Registered User
Posts: 278
Joined: Fri Feb 25, 2005 12:04 pm

Post by jerryT » Sun Jan 07, 2007 1:31 pm

Am I doing something stupid.. Because this is not working for me...

Installation was very straight forward using easy mod, I had to edit the entry for functions_post:

Entry spamwords was looking for:

Code: Select all

, enable_sig = $attach_sig" . $edited_sql . "
I changed to:

Code: Select all

, enable_sig = $attach_sig, post_icon = $post_icon" . $edited_sql . "
Installation completed fine, and the options show in ACP.
I mass imported some words from here

Logged out, then logged back in as a normal user.

I created a new post and enter one of the words from the list.. It posted fine.. nothing happened.

I have checked that I have spamwords turned on, but nothing happened...

Any ideas ?

Thanks

jerryT
Registered User
Posts: 278
Joined: Fri Feb 25, 2005 12:04 pm

Post by jerryT » Sun Jan 07, 2007 4:09 pm

Got it working..

I have other mod installed and the issue was down to my posting.php.
The first couple of finds, found the correct entries, but they were for lines added by another MOD.

I deleted then new additions from those lines, and add then to the correct line.

Now working !

fpbear
Registered User
Posts: 17
Joined: Sun Sep 17, 2006 10:12 pm

Post by fpbear » Sun Jan 07, 2007 9:27 pm

This spamwords ban IP feature is one of the best mods for phpBB!!

To make it work with the guest posting mod, make the following change to spamwords.php. Otherwise the anonymous user could be banned, locking everyone out of the forum.

(The guest posting mod allows non-registered users to enter messages with captcha code confirmation instead.)

Code: Select all

if ($spam_config['ban_ip'])
                {
                        if ($userdata['user_id'] != ANONYMOUS)
                        {
                                $sql = "INSERT INTO " . BANLIST_TABLE . "(ban_userid, ban_ip)
                                VALUES (" . $userdata['user_id'] . ", '$user_ip')";

                                if (!($result = $db->sql_query($sql)))
                                {
                                        message_die(GENERAL_ERROR, 'Could not update banlist', '', __LINE__, __FILE__, $sql);
                                }
                        }
                        else
                        {
                                $sql = "INSERT INTO " . BANLIST_TABLE . "(ban_ip)
                                VALUES ('$user_ip')";

                                if (!($result = $db->sql_query($sql)))
                                {
                                        message_die(GENERAL_ERROR, 'Could not update banlist', '', __LINE__, __FILE__, $sql);
                                }
                        }
                }

Post Reply

Return to “[2.0.x] MOD Database Releases”