Saturday, January 9, 2016

How to avoid spam in phpBB forums

phpBB is a great forum management software that includes multiple configuration options, with many templates and a huge community. Also, it's open source and free. So, does it has any inconvenience?

Yep, an important one. It get lots of spam. Fortunately, there are several methods of getting rid of it, but they are not very effective and requires some extra effort by the administrator and sometimes by the users: captchas, password strength, cipher files, email filtering and so on. However, they definitely don't stop the huge amount of automatic spam posts.

How do spammers do it? It's quite simple for them. The use an automatic posting software that lets them submit hundreds of posts with just one click. It registers a random username and submit messages without the need of the user interaction. It works because every phpBB forum works internally in the same way, but if you change an important function name, for registration, for example, their software will not work with your forum.

For example they will try to register automatically with this kind of address: http://www.exampleforum.com/ucp.php?mode=register&sid=ef2d8343918da15b0d0df78c05a1a82b

If you change the 'register' word in that link for 'registration', 'signup' or 'hamburger', for example their software will not have access to your forum.

I did this and my spam rate fell to 0%. I have not had a single junk message for more than 3 years. It's easy to do, but requires a little patience and very basic programming skills.

Let's do it!


You only have to download your forum source code. Make a security copy, keep it safe and now we are going to modify some files. You'll need a text editor for that, like Sublime Text, Notepad++ or a similar one. Don't use Wordpad or Microsoft Word because they add extra characters that will corrupt your text files.

We are going to modify the 'register' string and we will replace it by 'registration', 'registr' or any other word in all the files. In your text editor do a search in your phpBB folder (Edit -> Search in Folder) and it will show you that there are 3 files with this string (the content of the following lines may vary depending on your phpBB version. This is for 3.0.11):

/includes/functions.php, the line 4601 of this file will be replaced by this one (it should be identical but modifying mode=register by mode=registr):
'U_REGISTER'     => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=registr')


/includes/ucp/ucp_register.php, in lines 132, 133, 137,149 y 471 you have to change mode=register by mode=registr in each of them

/ucp.php, line 61 should by replaced by
case 'registr':


/viewonline.php, in line 289 we will change 'register' by 'registration' as well:
'mode=registration'     => 'VIEWING_REGISTER',


That's all. Simply upload these 3 files to your server, replacing the existing ones and test it. Be sure that everything is working fine, for example, creating a new user and check if you can login and post messages.
If everything went fine this will solve your spam problems definitely.

No comments:

Post a Comment