Joe Belmaati wrote:
noth wrote:
spammers are now flooding 'Occupation' and 'Interests' with http:// web addresses

and this mod cannot fight that
This MOD can be extended to check those fields. I think I hacked something together for someone back some 20 or so pages.
Perhaps it's not 20 pages back but in my inbox: A while back you have sent me some code for preventing spam users from
registering to the forum. I've applied this patch just two days ago and have little experience with it, but I guess it works well. Sure enough I have modified the error message shown if spam was detected. And logging is missing, so there's no feedback/control for the administrator. The good thing is that one spam word list must be administered, only.
Note:
Spam users often use specific mail domains, e.g. *@shalua.info which can be filtered by the normal ban filter, see ACP > User Admin > Ban Control > Ban one or more email addresses.
The mail:
Joe Belmaati wrote:
... this checks all userfields for urls and spamwords. If found an error message is thrown. ...
OPEN
includes/usercp_register
FIND
BEFORE, ADD
Code: Select all
function spamcheck($param)
{
global $db;
if(@strpos(strtolower($param), '[url') !== false)
{
message_die(GENERAL_ERROR, 'No url allowed');
}
$sql = "SELECT * FROM " . SPAM_WORDS_TABLE;
if (!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not get spam words from database', '', __LINE__, __FILE__, $sql);
}
$param = preg_replace("#\[.{12,16}\]#i", '', $param);
$param = preg_replace('/\[url\]|\[\/url\]/si', '', $param);
$param = preg_replace('#\[url=|\]|\[/url\]#si', '', $param);
if ($row = $db->sql_fetchrow($result))
{
do
{
if (preg_match('#\b(' . str_replace('\*', '\w*?', phpbb_preg_quote($row['spam_word'], '#')) . ')\b#i', $param))
{
message_die(GENERAL_ERROR, 'Not allowed');
}
}
while ($row = $db->sql_fetchrow($result));
}
}
FIND
Code: Select all
//
// Did the user submit? In this case build a query to update the users profile in the DB
//
BEFORE, ADD
Code: Select all
if($mode == 'register')
{
$check_fields = array($username, $email, $icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature);
array_map('spamcheck', $check_fields);
}