PDA

View Full Version : Username Registration (A-Z, 0-9 Characters Only)


untold4you
07-15-2005, 10:00 PM
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:
INSERT INTO setting ( varname , grouptitle , value , defaultvalue , optioncode , displayorder , advanced , volatile )
VALUES (
'az09characters', 'register', '1', '1', 'yesno', '101', '0', '1'
)

Phrases To Add:

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:

// 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_semicolo n'));
eval('$errors[10] = "' . fetch_phrase('username_semicolon', PHRASETYPEID_ERROR) . '";');
}

Above that add:

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



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....

T3MEDIA
07-16-2005, 11:06 AM
I did something like this that is less intensive...
I wont put the link to highjack your thread but maybe we can do something that is better for both hacks... a new cleaner version?

Up to you.

waza
07-16-2005, 11:39 AM
thx,
that way my users can have a subdomain.

Erwin
07-22-2005, 10:27 AM
This should really be standard with vB. :)

uae
08-22-2005, 08:26 AM
I would love to see this hack ported to vB3.5

Thanks.

PixelFx
08-22-2005, 08:31 AM
This should really be standard with vB. :)

I agree

Gio~Logist
09-09-2005, 07:05 PM
I have a question.....

What are the symbols that YOU SHOULD RESTRICT, if you use mod re-write to make profiles be www.site.com/username

Because i know that there are some characters that either might effect the LINK itself, can be used to ppossible "hack" the site, etc.

untold4you
09-09-2005, 08:12 PM
Maybe this is what your looking for? http://forum.modrewrite.com/viewtopic.php?t=571

Update: http://forum.modrewrite.com/viewtopic.php?t=127

Gio~Logist
09-09-2005, 09:45 PM
I think those are for subdomains...... mines isnt username.site.com it's site.com/username Perhaps all i should exclude is /?

007
09-10-2005, 08:16 PM
I loved this in vb3.0... Does anybody plan to port it? I am going to try, but I haven't used the hook system yet. I think this could be made as a product or plugin, but I'm not really sure.

altsounds
09-19-2005, 02:21 AM
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??

untold4you
09-19-2005, 04:28 AM
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??

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

Like you asked, how to allow spaces? Just put a space in the regex :)

altsounds
09-19-2005, 04:44 AM
Thanks will try this tommorow :D

altsounds
09-21-2005, 08:07 PM
Added this today and it works a treat!! Thanks untold4you.

akanevsky
10-10-2005, 08:15 PM
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 :)

untold4you
10-10-2005, 09:09 PM
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...

akanevsky
10-10-2005, 09:19 PM
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

untold4you
10-10-2005, 09:28 PM
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:

akanevsky
10-10-2005, 09:36 PM
Yes, and all you have to do is replace
if (!eregi("^[A-Za-z0-9]+$", $_POST['username']))
With
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" :)

eljeffe
12-11-2005, 03:28 PM
// Only A-Z, 0-9 [:space:] Characters Only */
if ($vboptions['az09characters'])
{
if (!eregi("^[A-Za-z0-9 ]+$", $_POST['username']))
{
eval(print_standard_error('error_az09charactersonl y'));
}
}

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?

PixelFx
12-21-2005, 05:15 AM
Is there a way to modify this to accept dash and underscore as valid characters?

has anyone made this for vb3.5.0 ? I've just wiped 9000 accounts off my site .. and I know many of the accounts will be coming back with the new site. I'd really like to have something like this in place before my new site goes public. :D

untold4you
12-21-2005, 08:15 AM
<a href="https://vborg.vbsupport.ru/showthread.php?t=96922" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=96922</a> here it is. However i've not yet tested this on the latest verion. Gr²³tz and hope i was of any help to you...