PDA

View Full Version : Looking for the opposite of "banned emails"


Idodo
09-05-2004, 09:48 PM
i need to allow users to register only with email providers that i choose (like ISPs).
there is too many free emails service and i can't ban them all.
so i need to allow users to register only from domains that i want.

Thanks,
Ido.

Xenon
09-07-2004, 12:19 AM
quick'n'dirty but should work:

open includes/functions_user.php find this function:

// ###################### Start checkbannedemail #######################
function is_banned_email($email)
{
global $vboptions, $datastore;

if ($vboptions['enablebanning'] AND !empty($datastore['banemail']))
{
$bannedemails = preg_split('/\s+/', $datastore['banemail'], -1, PREG_SPLIT_NO_EMPTY);

foreach ($bannedemails AS $bannedemail)
{
if (is_valid_email($bannedemail))
{
$regex = '^' . preg_quote($bannedemail, '#') . '$';
}
else
{
$regex = preg_quote($bannedemail, '#');
}

if (preg_match("#$regex#i", $email))
{
return 1;
}
}
}

return 0;
}


and change it into:

// ###################### Start checkbannedemail #######################
function is_banned_email($email)
{
global $vboptions, $datastore;

if ($vboptions['enablebanning'] AND !empty($datastore['banemail']))
{
$bannedemails = preg_split('/\s+/', $datastore['banemail'], -1, PREG_SPLIT_NO_EMPTY);

foreach ($bannedemails AS $bannedemail)
{
if (is_valid_email($bannedemail))
{
$regex = '^' . preg_quote($bannedemail, '#') . '$';
}
else
{
$regex = preg_quote($bannedemail, '#');
}

if (preg_match("#$regex#i", $email))
{
return 0;
}
}
return 1;
}

return 0;
}

that inverts the banned email checking of vb, so all emails you enter in the banning textfield will be allowed, and every mail else won't be.

(at least it should ;))

Idodo
09-07-2004, 02:39 PM
I'll check it right now :)
thanks!

Xenon
09-07-2004, 04:18 PM
you're welcome :)

LanciaStratos
01-08-2005, 09:17 PM
I'm using this also, many thanks Xenon!

bigcurt
01-09-2005, 02:29 AM
Floris have this for his site. He blocks yahoo and aol lol.

-=Sniper=-
01-21-2005, 06:39 PM
Any chance of expanding this request, so it would work like the following,

when someone tries to register though a email in the allowed list he/she has no problems, how ever if a unknown domain is used, the admin has the verify the user, if the admin verifies the user the domain is added to the accept list automatically or manually.

thanks

JMikeS
06-21-2005, 03:01 PM
Everyone using this successfully? I must use this for our forums.

Thanks,
Mike

futuredood
06-15-2006, 08:23 AM
can someone get this working for 3.5.4?

JMikeS
09-06-2006, 06:39 PM
This doesn't work with 3.6, any suggestions? The original function is:


// ###################### Start checkbannedemail #######################
function is_banned_email($email)
{
global $vbulletin;

if ($vbulletin->options['enablebanning'] AND $vbulletin->banemail !== null)
{
$bannedemails = preg_split('/\s+/', $vbulletin->banemail, -1, PREG_SPLIT_NO_EMPTY);

foreach ($bannedemails AS $bannedemail)
{
if (is_valid_email($bannedemail))
{
$regex = '^' . preg_quote($bannedemail, '#') . '$';
}
else
{
$regex = preg_quote($bannedemail, '#') . ($vbulletin->options['aggressiveemailban'] ? '' : '$');
}

if (preg_match("#$regex#i", $email))
{
return 1;
}
}
}

return 0;
}

Booost This
11-04-2007, 06:00 AM
Reviewed for 3.6.8

It should work, I tired it.


// ###################### Start checkbannedemail #######################
function is_banned_email($email)
{
global $vbulletin;

if ($vbulletin->options['enablebanning'] AND $vbulletin->banemail !== null)
{
$bannedemails = preg_split('/\s+/', $vbulletin->banemail, -1, PREG_SPLIT_NO_EMPTY);

foreach ($bannedemails AS $bannedemail)
{
if (is_valid_email($bannedemail))
{
$regex = '^' . preg_quote($bannedemail, '#') . '$';
}
else
{
$regex = preg_quote($bannedemail, '#') . ($vbulletin->options['aggressiveemailban'] ? '' : '$');
}

if (preg_match("#$regex#i", $email))
{
return 0;
}
}
return 1;
}

return 0;
}

Analogpoint
11-05-2007, 01:28 PM
The email rules mod (https://vborg.vbsupport.ru/showthread.php?t=160338) allows you to require your users to have an email from certain providers/domains that yous specify.