A good way to stop spammers on a phpBB3 message board
Posted: Sat Apr 23, 2011 8:12 pm
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:
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:
Just after this, add the following code:
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
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>
Code: Select all
<?php
/**
*
* @package ucp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
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();
}
}
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