miniBB ® 


Support Forums
 | Start | Register | Search | Statistics | File Bank | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /  

Blocking registration emails filtered by domain, or some other criteria

Author Paul
Lead Developer 
#1 | Posted: 4 Aug 2015 19:09 
Referencing to the topic named «Blocking registration emails filtered by domain», and all the suggestions and the codes mentioned, I have built the united solution for disabling registration or profile's updating processes, if the email put meets some criteria.

Put this code under bb_plugins.php, possibly at the top part of it:

/* Registration — disabled some email accounts */
if($action=='register' or $action=='editprefs'){

function dotsInEmail($chkEmail){

$spl=explode('@', $chkEmail);
for($i=0; $i<strlen($un); $i++){
if($un[$i]=='.') $dots++;
if($dots>=$dotsLimit) return TRUE;
else return FALSE;


function disallowedEmailDomain($chkEmail) {
foreach($disallowed_domains as $dd){
if(substr_count($chkEmail, '@'.$dd)>0){
return $dis;

if(isset($_POST['email'])) $chkEmail=strtolower(trim($_POST['email'])); else $chkEmail='';

if(substr_count($chkEmail, '@')==1){
if(substr($chkEmail, -9)=='' and dotsInEmail($chkEmail)) $correct=7;
elseif(disallowedEmailDomain($chkEmail)) $correct=7;

/* --Registration — disabled some email accounts */
Under your language pack lang/eng.php or another, add this variable:

/* Forbidden email */
$l_userErrors[7]='You couldn\'t use this email address for registration! Try another one.';

This code for bb_plugins.php consists of two parts.

The function named dotsInEmail checks email addresses for the number of dots put in. I've noticed, that spammers often use automated emails containing multiple dots, like:
etc. But usually, if a dot is used in the email address, it should be just one, separating name/surname. Considering this, the function will disallow to register any address, if it's first part containing more than one dot. The number of dots could be changed in the function itself, here:


The function disallowedEmailDomain is about filtering out any email, which contains any domain specified under $disallowed_domains — they should be specified in lowercase.

It's possible to disable this or that function, or include both (now they are included both). For example, if you would like to enable just a dots filtering, change code to this:

if(substr($chkEmail, -9)=='' and dotsInEmail($chkEmail)) $correct=7;
//elseif(disallowedEmailDomain($chkEmail)) $correct=7;
or in the case of enabling just domain-filtering, put this:

//if(substr($chkEmail, -9)=='' and dotsInEmail($chkEmail)) $correct=7;
if(disallowedEmailDomain($chkEmail)) $correct=7;
You're welcome to put further comments here, 'cause I will close the older thread.

Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /
 Blocking registration emails filtered by domain, or some other criteria
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message

Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.

Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.


miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Try the Captcha add-on: protect your miniBB-forums from the automated spam and flood.