vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   apostrophe in their usernames (https://vborg.vbsupport.ru/showthread.php?t=136986)

Kihon Kata 01-20-2007 01:04 AM

apostrophe in their usernames
 
How can I easily prevent users from registering with an apostrophe in their usernames?

Thanks in advance!

Why does no one reply to threads like this? I am posting on the wrong site?

Attilitus 01-20-2007 09:53 PM

You merely need to go into vbulletin settings and add apostrophes to the banned characters for usernames. :)

Kihon Kata 01-20-2007 10:38 PM

Quote:

Originally Posted by Attilitus (Post 1163829)
You merely need to go into vbulletin settings and add apostrophes to the banned characters for usernames. :)

and where do I find that? I don't see a Banned Character section

Attilitus 01-20-2007 11:03 PM

Go to vbulletin options, then to User Registration Options.

Then find Username Regular Expressions. Click on the "help button" in order to view the REGEX codes which allow certain characters.

I will go ahead and paste the contents of the helpbutton.
Code:

^[A-Z]+$ - Characters from A-Z only
^[A-Z ]+$ - Characters from A-Z including space
^[A-Z0-9 ]+$ - Alphanumeric characters including space
^[\x20-\x7E]+$ - ASCII characters from 32-127

So just choose the allowed characters that you want in usernames, and paste that into the Username Regular Expressions option field in vbulletin options under User Registration Options.

Kihon Kata 01-21-2007 01:42 AM

Quote:

Originally Posted by Attilitus (Post 1163876)
Go to vbulletin options, then to User Registration Options.

Then find Username Regular Expressions. Click on the "help button" in order to view the REGEX codes which allow certain characters.

I will go ahead and paste the contents of the helpbutton.
Code:

^[A-Z]+$ - Characters from A-Z only
^[A-Z ]+$ - Characters from A-Z including space
^[A-Z0-9 ]+$ - Alphanumeric characters including space
^[\x20-\x7E]+$ - ASCII characters from 32-127

So just choose the allowed characters that you want in usernames, and paste that into the Username Regular Expressions option field in vbulletin options under User Registration Options.

Thanks, but I don't get it. How would one allow everything except apostraphes?

Attilitus 01-21-2007 02:00 AM

You would be best choosing one of the options.

^[A-Z0-9 ]+$

Would allow all letters, numbers, and spaces, while disallowing all other characters.

Is there a specific reason why you only want to ban apostrophes?

Merriweather 03-04-2007 10:39 PM

If you try to register with an apostrophe, you get a DB error because it breaks the MySQL query. You also can't administer a user account with an apostrophe in it. vB should ban it by default, or take this into account, but apparently they don't.

I used the regex to only allow letters, numbers and spaces, but the problem now is that if you use something other than those, it doesn't tell you that's why you get an error, it says "that username already exists", which isn't true.

Kirk Y 03-04-2007 10:50 PM

It is... all vBulletin input fields are cleaned to prevent such things.

Cap'n Steve 03-05-2007 12:56 AM

^--- I'm pretty sure apostrophes work in usernames.

Quote:

Originally Posted by Merriweather (Post 1195799)
If you try to register with an apostrophe, you get a DB error because it breaks the MySQL query. You also can't administer a user account with an apostrophe in it. vB should ban it by default, or take this into account, but apparently they don't.

It sounds like you have a poorly made mod installed.

Adrian Schneider 03-05-2007 01:13 AM

Apostrophes should be OK. You should rarely have to deal with the username though - that is what the userid column is for.

Anyway, to escape it:
PHP Code:

$username $db->escape_string($username); 



All times are GMT. The time now is 10:07 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.01071 seconds
  • Memory Usage 1,739KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (3)bbcode_quote_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