The last few weeks I delete a lot of spam posts in my forum. The most of posts is created by users, which email is generated (or not) from a few domains.
And today I decided to block on registration new user level, and I added a few code lines into components\com_users\models\registration.php file.
I found a function
Code: Select all
public function register
This is my lines (may be with extra checks)
Code: Select all
// Add before
// Bind the data.
if (1==1)
{
$cur_banned = array('sina.com', 'ukpayday24.com', 'kidalylose.pl', 'lylilupuzy.pl');
$cur_email = $data['email'];
if ($cur_email == "")
{
$this->setError("Email is null");
return false;
}
$cur_email_at = strpos($cur_email, "@");
if ($cur_email_at === false)
{
$this->setError("Email does not contain @");
return false;
}
$cur_email_domain = strtolower(substr($cur_email, $cur_email_at+1));
if (in_array($cur_email_domain, $cur_banned))
{
$this->setError("Email domain is banned!");
return false;
}
}
After then add into registration options new parameter - use ban list.
And in my code change 1==1 to check this parameter.
And variable $cur_banned fill by query your domain list.
With this featues you can not only block definite user, but can have easy way to stop registering new spam users from domains you know