Page 1 of 1

A good way to stop spammers on a phpBB3 message board

Posted: Sat Apr 23, 2011 8:12 pm
by Mopar93
I see mentions of spam on this board. It's a real problem and if you'd like to see a solution to 95% of it, keep reading.

Since this is a phpbb board, this will stop almost all of the spammers who attempt to register. First, create a new file in the main directory of the forum and call it "stopspammer.html". Enter the following text as the content of this file:

Code: Select all

<html>
<head>
<title>Spammer detected</title>
</head>
<body>
<h1>IP Detected As Spam Source</h1>
We are sorry, but you are not allowed to register at this
<br>message board as long as your IP address is listed
<br>at stopforumspam.com.
<p>
Once your IP address is removed, you will be allowed.
</body>
</html>
Next, find the file called "ucp.php" in the main directory. You will be adding a short amount of code in this file. Load it into a text editor and at the very first part, you'll find the following:

Code: Select all

<?php
/**
*
* @package ucp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
Just after this, add the following code:

Code: Select all

$req_uri = $_SERVER['REQUEST_URI'];
$reg_pattern = '/mode=register/';
if (preg_match($reg_pattern, $req_uri)) {
$addr = $_SERVER['REMOTE_ADDR'];
$response = file_get_contents('http://www.stopforumspam.com/api?ip='.$addr);
$pattern = '/<appears>yes<\/appears>/';
if (preg_match($pattern, $response)) {
require_once( './stopspammer.html' );
exit();
}
}
Now, save the newly edited file. You are all done.

What will happen now, is whenever someone tries to access the registration page, their IP address will be looked up at "stopforumspam.com". If the IP address is listed there as being a spam source, instead of being able to access the registration page, the "stopspammer.html" page will be sent instead.

Do the above and there will be far fewer spammers registering on this board.

-Maurice

Re: A good way to stop spammers on a phpBB3 message board

Posted: Fri Jan 06, 2012 9:16 pm
by lucy123
um...ok. this would keep out maybe 5% of spammer. spammers keep getting new ips. blocking by ip is not a good solution.

Re: A good way to stop spammers on a phpBB3 message board

Posted: Wed Jan 11, 2012 12:20 pm
by PacoLM
massagegirl wrote:oh,it's very good
This is really funny, a spammer posting in an anti-spam post, weird...

Re: A good way to stop spammers on a phpBB3 message board

Posted: Wed Jan 11, 2012 3:37 pm
by mastertheknife
PacoLM wrote:
massagegirl wrote:oh,it's very good
This is really funny, a spammer posting in an anti-spam post, weird...
hehe :D

Re: A good way to stop spammers on a phpBB3 message board

Posted: Wed Jan 11, 2012 11:55 pm
by bb99
I'm sure you read the original "Sensual tantric massage escort for you"

Re: A good way to stop spammers on a phpBB3 message board

Posted: Thu Jan 12, 2012 5:11 am
by PacoLM
bb99 wrote:I'm sure you read the original "Sensual tantric massage escort for you"
Yes, indeed!

Re: A good way to stop spammers on a phpBB3 message board

Posted: Sun Jan 29, 2012 11:51 pm
by cordel
Rather than commenting about spam it better to just use the forum tool to report it and not comment. This way we don't have to clutter the forum with unnecessary comments that we have to debate later weather to remove.
It always leaves a funny feeling in my stomach when I decide to delete a good standing users post just because it's talking about spam, unless it has something useful then I have to leave it. :idea: