Filter spam in BB streams

The purpose of spam is to display keywords and this is their weak point: by prohibiting the placement of these words that are not related to the forum theme (spam by definition), we easily stop their troubles.

Spammers use free access to forums to post links to sites selling or claiming to sell goods, usually for adults.

Even if links are banned, at least for new followers, you realise they keep adding spams, probably in the hope that Google will index its profile and its website URL.

FluxBB, which is a very minimal and lightweight system (this may be the reason for its use) and does not provide protection against spam. In addition to blocking an IP address that does not block proxies. Therefore, we must take our own measures.

Modify robots.txt

Prevent robots from parsing profiles so that it does not associate unwanted sites with the forum:

User-agent: *
Disallow:/forum/profile.php

It is assumed that flowBB is installed in the forum directory, otherwise the corresponding directory name will be specified.
You can also prevent the use of different files that you do not want to index.

Add filter to sent content

To do this, we will create a "filter.php" file containing various filters and which will be included in the post.php file .

This filter is inserted before the user sends the message, so before the line:

$now = time();

And it gives:

include("filter.php");
$now = time();  

Select Users

The filter should be applied to new users, so I did not receive a response from an authorized participant to the previous message .

The users table uses the username and num_posts columns, and the table last_post the id columns, edited_by returns users to the table .

Full administrator access

The administrator should also not be able to do everything on the site:

if(! is_admmod)
{
  include("filter.php");
} 

Prevent viewing images

It can be extremely undesirable.

if(stristr($message, "<img") !== false)
{
die('Images forbidden');
}

Prohibit links

if(stristr($message, "http://") !== false)
{
die('Links forbidden to new users');
}

Prohibit Russian characters

Unless, of course, messages in Russian are allowed on the forum.

if(stristr($message, "ð") || 
stristr($message, "ä") ||
stristr($message, "ë") ||
stristr($message, "ã") ||
stristr($message, "Ñ") ||
stristr($message, "ñ"))
{
die('English only forum');
}

Prohibit some keywords

if(stristr($message, "mot-clé-interdit") !== false)
{
die('Spam detected');
}