It is currently 20 Feb 2018, 21:35

Anything GoesHow to prevent spammers from signing up to your phpbb forum (Showcase | Slideshow)

Anything, almost anything at all
(even advertisement if it's decent, spammers will be banned)
Post Reply
User avatar

View: Showcase | Slideshow
Topic Posts: 1/1
Posts: 2162
Joined: 26 Sep 2016, 00:16
Cash on hand: 7,946.37 GLP
Bank: 51,356.25 GLP
Gender: Guy
Location: Victoria, BC
Operating System: Windows
GIMP Version: 2.8.22
My Personal Blog
My FineArtAmerica
x 1207
x 258

How to prevent spammers from signing up to your phpbb forum

Post#1 by tim » 30 Oct 2016, 05:31

I tried to install Stop Forum Extension for phpbb but right now it doesn't work for phpbb 3.1.10.
So I wrote something simple custom made to prevent reported spammers from registering using's api to check when ip is reported more than 5 times. Now the method i use only checks on ip address when user tries to register, and it only tries to call the api if it hasn't seen that ip address before, then it saves it to our own database so we don't too many requests to and get blocked for making too many requests.
I thought I'd share the code for those who'd like to implement this on their forum as well.
Basically I created 2 new files db.php, and check_ip.php.
Here's the code for db.php, just change values as you would for your database for $servername,$username,$password,$dbname

Code: Select all

$servername = "your_database_server:port_number";
$username = "your_database_user_name";
$password = "your_database_password";
$dbname = "your_database_name";
try {
    $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
    // set the PDO error mode to exception
    // echo "Connected successfully";
	// set utf 8 on connection so that we can display vietnamese characters as well
	$stmt = $conn->prepare("SET NAMES utf8;");
	$stmt = $conn->prepare("SET CHARACTER SET utf8;");
	$stmt = $conn->prepare("SET character_set_connection=utf8;");
catch(PDOException $e)
    echo "Connection failed: " . $e->getMessage();
this is the code for check_ip.php (zipped) just unzip it. #
(854 Bytes) Downloaded 30 times

Then you need to go to your MyPhpAdmin and create this database table ips table to store your queried data from

Code: Select all

Now in your /[FORUM_ROOT]/ucp.php file just add this one line at the very top

Code: Select all

<?php include 'check_ip.php';?>
upload db.php, and check_ip.php to your [FORUM_ROOT]
and that's it.

ip addresses that have been reported more than 5 times will see a blank page when they try to register on your forum.
0 x

aka Tin

Registered members enjoy ads-free content
Post Reply

Last 20 Members Who Visited This Topic

  • Similar Topics
    Last post
• Featuring Members' Works (Image Attachments Only) •
1: Ella
2: Pat625
3: oldmangrumpy
4: animicule
5: Issabella
6: oldmangrumpy
7: Conbagui

Who is online

Users browsing this forum: No registered users and 2 guests