Link spammers sign up to forums and place a link to some dodgy website in order to increase their rankings within search engines. For forum admins, this is a significant problem.
This script is designed to be run from the command line (on a schedule) and searches through the phpBB user's table for users whose "www" field contains specific keywords. If a match is found the script can be set to remove the URL, remove the URL and ban the user, or completely delete the user account.
You can also configure the script to only perform the action on accounts with zero posts as link spammers will rarely make a post on the forum.
The script is available in the zip file below.
php_phpbb_lsr.zip (9kb)
The script is designed to be used from a command line on a schedule, although will work equally well being called manually from a website URL. These instructions are not OS specific, you will need to look up scheduling for your operating system, for Linux you can set a Cron job.
Download the script and place it whereever desired.
An array containing all of the keywords to search for. A selection of keywords have been provided (my apologies for the obscenity, but it is required).
You can add as many or as few keywords as you like by copying the format they are already in.
When set to true, the script will only perform the action specified by mode (see below) if an offending user has 0 posts, otherwise it will perform the action regardless of how many posts.
Sets the action to take on any offending user accounts. Actions can be:
- Remove link.
- Remove link and ban the user.
- Delete the user.
Setting the mode to 0 will disable the script.
These should be self explanatory. Enter the database details into the relevant variables.
$db_pref specifies the table prefix you would have chosen when you installed phpBB. By default this is "phpbb_".
This script is designed to be executed from a command line with the intention of being set on a schedule for every 15 minutes or so. I realise for those that use external hosting and do not have that kind of control of the server this won't be possible.
The script will work equally well being executed on a web site leaving the only problem being scheduling it. On a Linux machine this can be achieved by creating a shell script to "wget www.yourdomain.com/phpbb_lsr.php" and adding it to /etc/cron.hourly/.