Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons

Reply
 
Thread Tools
Automatically deny registration for users with multi-dotted email address Details »»
Automatically deny registration for users with multi-dotted email address
Version: 1.00, by cloferba cloferba is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Category: Anti-Spam Options - Version: 4.2.0 Rating:
Released: 05-26-2012 Last Update: Never Installs: 18
Uses Plugins
Re-useable Code Translations  
No support by the author.

On my forum many bots have multi-dotted email address so I wanted to avoid them to create a new account on my forum.

The way to do this is create a new plugin to recognize these multi-dotted email address provided at time of registration and delete them automatically.

Steps:
  • Create a new plugin using hook userdata_start
  • Use this code:
Code:
$this->validfields['email'][VF_CODE] = '
    $max_dots = 1;
    if ($retval = $dm->verify_useremail($data))
    {
        $parts = explode("@", $data);
        if (is_array($parts) && substr_count($parts[0], ".") > $max_dots)
        {
            $dm->error("bademail");
            $retval = false;
        }
    }
    return $retval;
';
It only checks the part before the '@', so set $max_dots to the number of dots you will allow (I think one dot in an email name probably isn't unusual, but that's up to you). Also, this uses the default 'bademail' phrase, but if you'd rather have a special error messages for "too many dots" you can create a phrase and use the varname in place of 'bademail'.

Special thanks to kh99 who provided this solution.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:

Comments
  #12  
Old 05-27-2012, 11:53 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have complete faith in you, sir.
Reply With Quote
  #13  
Old 05-28-2012, 12:24 AM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

LOL. Well you're not going to get rich that way.
Reply With Quote
  #14  
Old 05-28-2012, 12:40 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll always be rich in friendship with you as a friend.
Reply With Quote
  #15  
Old 05-28-2012, 01:46 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Snowhog View Post
You could write two additional plugins (give each a unique plugin name) using the code with only a slight modification.
That's a good thought, but unfortunately it won't work the way this is written. It replaces the code that verifies an email address, so if you have multiple plugins doing the same thing, only the last one to run would have any effect.

You might be able to do something like this:

Code:
$this->validfields['email'][VF_CODE] = '
    $max_chars = array("." => 1, ":" => 0, ";" => 0);
    if ($retval = $dm->verify_useremail($data))
    {
        $parts = explode("@", $data);
        if (is_array($parts))
        {
           foreach($max_chars AS $char => $max)
           {
               if (substr_count($parts[0], $char) > $max)
               {
                      $dm->error("bademail");
                      $retval = false;
                      break;
               }
           }
        }
    }
    return $retval;
';

(But I haven't tested it at all).
Reply With Quote
Благодарность от:
djbaxter
  #16  
Old 05-28-2012, 01:52 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You could even make the array a setting option to expand it.
Reply With Quote
  #17  
Old 05-28-2012, 06:08 AM
John Lester John Lester is offline
 
Join Date: Nov 2004
Posts: 543
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Shouldn't this be titled something like "Automatically deny registration for users with multi-dotted email address" since it doesn't actually delete anything?
Reply With Quote
  #18  
Old 05-28-2012, 10:51 AM
cloferba cloferba is offline
 
Join Date: Apr 2009
Posts: 437
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by John Lester View Post
Shouldn't this be titled something like "Automatically deny registration for users with multi-dotted email address" since it doesn't actually delete anything?
you are right
Reply With Quote
  #19  
Old 05-28-2012, 01:13 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Or "Prevent users from registering with SPAM-like email addresses".
Reply With Quote
  #20  
Old 05-28-2012, 05:34 PM
victorvu victorvu is offline
 
Join Date: Mar 2011
Posts: 134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi:

This is totally unrelated, but I ask anyway. Hope that I will get the suggestion.

I want to deny guests who IPs do not show up in the list. How can I do this?

Thanks.

Victor
Reply With Quote
  #21  
Old 05-29-2012, 03:05 PM
djbaxter djbaxter is offline
 
Join Date: Aug 2006
Location: Ottawa, Canada
Posts: 2,601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
That's a good thought, but unfortunately it won't work the way this is written. It replaces the code that verifies an email address, so if you have multiple plugins doing the same thing, only the last one to run would have any effect.

You might be able to do something like this:
Perfect.

Slight modification to prevent commas, semicolons, and colons, since I got another Chinese bot this morning trying to register with the email "liantianha,ofangjiancong@gmail.com":


PHP Code:
$this->validfields['email'][VF_CODE] = '
    $max_chars = array("." => 1, "," => 0,  ";" => 0, ":" => 0);
    if ($retval = $dm->verify_useremail($data))
    {
        $parts = explode("@", $data);
        if (is_array($parts))
        {
           foreach($max_chars AS $char => $max)
           {
               if (substr_count($parts[0], $char) > $max)
               {
                      $dm->error("bademail");
                      $retval = false;
                      break;
               }
           }
        }
    }
    return $retval;
'

Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:14 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04992 seconds
  • Memory Usage 2,331KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (1)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete