vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Looking for the opposite of "banned emails" (https://vborg.vbsupport.ru/showthread.php?t=69125)

Idodo 09-05-2004 09:48 PM

Looking for the opposite of "banned emails"
 
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:

PHP Code:

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

    if (
$vboptions['enablebanning'] AND !empty($datastore['banemail']))
    {
        
$bannedemails preg_split('/\s+/'$datastore['banemail'], -1PREG_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:

PHP Code:

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

    if (
$vboptions['enablebanning'] AND !empty($datastore['banemail']))
    {
        
$bannedemails preg_split('/\s+/'$datastore['banemail'], -1PREG_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:

PHP Code:

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

    if (
$vbulletin->options['enablebanning'] AND $vbulletin->banemail !== null)
    {
        
$bannedemails preg_split('/\s+/'$vbulletin->banemail, -1PREG_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;




All times are GMT. The time now is 09:56 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01139 seconds
  • Memory Usage 1,760KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete