Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Username Registration (A-Z, 0-9 Characters Only) Details »»
Username Registration (A-Z, 0-9 Characters Only)
Version: 1.00, by untold4you untold4you is offline
Developer Last Online: May 2011 Show Printable Version Email this Page

Version: 3.0.7 Rating:
Released: 07-15-2005 Last Update: Never Installs: 10
DB Changes
Code Changes  
No support by the author.

In Reply to this thread: https://vborg.vbsupport.ru/showthread.php?t=92308

Only accept usernames with no special characters or spaces.

Database query:

Open up PhpMyAdmin, goto to your vbulletin database, run following query:
Code:
INSERT INTO setting ( varname , grouptitle , value , defaultvalue , optioncode , displayorder , advanced , volatile )
VALUES (
'az09characters', 'register', '1', '1', 'yesno', '101', '0', '1'
)
Phrases To Add:

Code:
Phrase Type: Front-End Error Messages
Varname:     az09charactersonly
Text:        Only  characters A-Z, 0-9 may be used in usernames, no spaces, no special ascii-type letters.

Phrase Type: vBulletin Settings
Varname:     setting_az09characters_title
Text:	     Disallow Special Characters

Phrase type: vBulletin Settings
Varname:     setting_az09characters_desc
Text:        Setting this to "yes" prevents users from using special characters or spaces in there user name.

File Modifications:

Open:

[forumroot]/register.php

Find:

PHP Code:
    // check username does not contain semi-colons
    
if (preg_match('/(?<!&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5});/'$_POST['username']))
    {
        
//eval(print_standard_error('error_username_semicolon'));
        
eval('$errors[10] = "' fetch_phrase('username_semicolon'PHRASETYPEID_ERROR) . '";');
    } 
Above that add:

PHP Code:
    // Only A-Z, 0-9 Characters Only */
    
if ($vboptions['az09characters'])
    {
        if (!
eregi("^[A-Za-z0-9]+$"$_POST['username']))
        {
            eval(
print_standard_error('error_az09charactersonly'));
        }    
    } 
Save:

register.php

Now users can not use special chars or spaces in their username when signing up.

To disable the function goto, Admin CP > vBulletin Options > User Registration Options.
Find the yes/no option under ?Disallow Special Characters ?

That's all, Gr3?Tz Untold....

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 09-19-2005, 02:21 AM
altsounds altsounds is offline
 
Join Date: Dec 2004
Posts: 88
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How can I use this to allow a-z A-z 0-9 and spaces?? In other words what would I need to do to get this existing hack to work but still allow spaces in usernames??
Reply With Quote
  #13  
Old 09-19-2005, 04:28 AM
untold4you's Avatar
untold4you untold4you is offline
 
Join Date: Feb 2005
Location: In Tyranny
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by altsounds
How can I use this to allow a-z A-z 0-9 and spaces?? In other words what would I need to do to get this existing hack to work but still allow spaces in usernames??
PHP Code:
// Only A-Z, 0-9 [:space:] Characters Only */ 
    
if ($vboptions['az09characters']) 
    { 
        if (!
eregi("^[A-Za-z0-9 ]+$"$_POST['username'])) 
        { 
            eval(
print_standard_error('error_az09charactersonly')); 
        }     
    } 
Like you asked, how to allow spaces? Just put a space in the regex
Reply With Quote
  #14  
Old 09-19-2005, 04:44 AM
altsounds altsounds is offline
 
Join Date: Dec 2004
Posts: 88
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks will try this tommorow
Reply With Quote
  #15  
Old 09-21-2005, 08:07 PM
altsounds altsounds is offline
 
Join Date: Dec 2004
Posts: 88
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Added this today and it works a treat!! Thanks untold4you.
Reply With Quote
  #16  
Old 10-10-2005, 08:15 PM
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Posts: 3,972
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice hack bro, but could you please make a vBulletin option that would allow board administrator to specify a custom allowed letter range (so that besides English, another language or languages would be allowed)? Thanks
Reply With Quote
  #17  
Old 10-10-2005, 09:09 PM
untold4you's Avatar
untold4you untold4you is offline
 
Join Date: Feb 2005
Location: In Tyranny
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dark Visor
Nice hack bro, but could you please make a vBulletin option that would allow board administrator to specify a custom allowed letter range (so that besides English, another language or languages would be allowed)? Thanks
Will look into that m8, however 3.5.0 version it will be.

Gr3?Tz...
Reply With Quote
  #18  
Old 10-10-2005, 09:19 PM
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Posts: 3,972
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
however 3.5.0 version it will be
It's all good, because I plan to upgrade each my board shortly... And why would I want any more hack for 3.0.x, if 3.5.0 is much better? :P
Reply With Quote
  #19  
Old 10-10-2005, 09:28 PM
untold4you's Avatar
untold4you untold4you is offline
 
Join Date: Feb 2005
Location: In Tyranny
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dark Visor
a vBulletin option that would allow board administrator to specify a custom allowed letter range (so that besides English, another language or languages would be allowed)
Hmm let me think, i could make a field in the options where you can enter your own regex? Would that do the job ? Because i'm not a regex freak :disappointed:
Reply With Quote
  #20  
Old 10-10-2005, 09:36 PM
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Posts: 3,972
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, and all you have to do is replace
Code:
if (!eregi("^[A-Za-z0-9]+$", $_POST['username']))
With
Code:
if (!eregi("^[A-Za-z" . $vboptions['mycustomoption'] . "0-9]+$", $_POST['username']))
That way when the option is filled by the admin, it will automatically be inserted into your regex
Also, a shorter form of "A-Za-z" in a regex would be a simple "A-z"
Reply With Quote
  #21  
Old 12-11-2005, 03:28 PM
eljeffe eljeffe is offline
 
Join Date: Aug 2005
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by untold4you
PHP Code:
// Only A-Z, 0-9 [:space:] Characters Only */ 
    
if ($vboptions['az09characters']) 
    { 
        if (!
eregi("^[A-Za-z0-9 ]+$"$_POST['username'])) 
        { 
            eval(
print_standard_error('error_az09charactersonly')); 
        }     
    } 
Like you asked, how to allow spaces? Just put a space in the regex
Is there a way to modify this to accept dash and underscore as valid characters?
Reply With Quote
Reply


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 06:52 AM.


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.05699 seconds
  • Memory Usage 2,326KB
  • 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
  • (4)bbcode_code
  • (4)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete