Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Username characters

Asked Modified Viewed 4,596 times
J
Jason
J
Jason 10
  • Newbie, joined since
  • Contributed 5 posts on the community forums.
  • Started 2 threads in the forums
  • Started this discussions
asked
Newbie

Hello how would i be able to add a "." (dot) to a username i would like to create member accounts usersname like firstname.lastname but everytime i try i get an error


Quote

The member account could not be created.

User name contains invalid characters.

Return to Members Admin

Return to Admin Index


Would anybody know how to allow . as a valid character?
0 replies

13 posts

R
Rayxen
R
Rayxen 10
  • Member, joined since
  • Contributed 153 posts on the community forums.
  • Started 21 threads in the forums
answered
Member

Watch this thread. It's the same idea, but for passwords rather than usernames. http://www.php-fusion.co.uk/forum/vie...post_44857

Just beware though. That with regex, the . has a special meaning. So make sure you do a bit of reading to make sure you're using it properly. ie. check if it needs to be 'escaped' with a backslash or something.
0 replies
J
Jason
J
Jason 10
  • Newbie, joined since
  • Contributed 5 posts on the community forums.
  • Started 2 threads in the forums
  • Started this discussions
answered
Newbie

Thanks Rayxen :-D
0 replies
T
TehDagda
T
http://9c0.com/
  • Newbie, joined since
  • Contributed 4 posts on the community forums.
answered
Newbie

I updated the same four files to allow a "." in the username:
/administration/members.php
/administration/updateuser.php
/includes/update_profile_include.php
/register.php

and have not had a problem (yet). I replaced
bad code deleted

with
bad code deleted

in each file (although it's $user_name in updateuser.php, not $username).
Edited by TehDagda on 18-10-2005 00:36,
0 replies
T
TehDagda
T
http://9c0.com/
  • Newbie, joined since
  • Contributed 4 posts on the community forums.
answered
Newbie

Ok, this is better. I replaced
preg_match("/^[-0-9A-Z_@\s]+$/i", $username)

with
preg_match("/^[-.0-9A-Z_@\s]+$/i", $username)
0 replies
— 10 months later —
C
Caboose2099
C
  • Newbie, joined since
  • Contributed 1 post on the community forums.
answered
Newbie

TOTAL NOOB here.... How about modding to allow ~ and | so that ~|DSC|~ can be added to user names..... Thanks

NOTE: Talking bout the lines over the "\" key...
0 replies
— 3 months later —
S
SaltyBob
S
  • Newbie, joined since
  • Contributed 5 posts on the community forums.
  • Started 2 threads in the forums
answered
Newbie

Caboose2099,

Just like TehDagda said...

update the following files:
/administration/members.php
/administration/updateuser.php
/includes/update_profile_include.php
/register.php

Where it says:

Quote

preg_match("/^[-0-9A-Z_@\s]+$/i", $username)

or

Quote

preg_match("/^[-0-9A-Z_@\s]+$/i", $user_name)

Within updateuser.php

Where it says the [-0-9A-Z_@\s] you want to put your special characters in the []'s so for example :

Quote

preg_match("/^[-0-9A-Z_@\s~|]+$/i", $username)


There is more information about using the special characters in PHP on this site : http://www.inrialpes.fr/vasy/cadp/man...egexp.html

Note: it may be a bit confusing the first read, but if you read it a couple of times, you may get it...

I had to play with it a bit when i wanted the {} 's to be accepted in user names...
0 replies
— 2 months later —
H
hippocanjump
H
  • Junior Member, joined since
  • Contributed 18 posts on the community forums.
  • Started 5 threads in the forums
answered
Junior Member

Nice,

but how to add cyrilic alphabet characters?

Thanks.
0 replies
H
hippocanjump
H
  • Junior Member, joined since
  • Contributed 18 posts on the community forums.
  • Started 5 threads in the forums
answered
Junior Member

Quote

SaltyBob wrote:
Caboose2099,

Just like TehDagda said...

update the following files:
/administration/members.php
/administration/updateuser.php
/includes/update_profile_include.php
/register.php

Where it says:

Quote

preg_match("/^[-0-9A-Z_@\s]+$/i", $username)

or

Quote

preg_match("/^[-0-9A-Z_@\s]+$/i", $user_name)

Within updateuser.php

Where it says the [-0-9A-Z_@\s] you want to put your special characters in the []'s so for example :

Quote

preg_match("/^[-0-9A-Z_@\s~|]+$/i", $username)


There is more information about using the special characters in PHP on this site : http://www.inrialpes.fr/vasy/cadp/man...egexp.html

Note: it may be a bit confusing the first read, but if you read it a couple of times, you may get it...

I had to play with it a bit when i wanted the {} 's to be accepted in user names...



Following your post I inserted cyrillic alphabet characters. The problem is that php does not recognize the encoding. So I had to re-encode the whole .php file into a different character encoding, which is capable of handling the cyrillics.:)
0 replies
— 1 month later —
T
TabbeN
T
TabbeN 10
  • Newbie, joined since
  • Contributed 3 posts on the community forums.
answered
Newbie

all this is working bu if i wants to add [ ] in the username ??
ex [UNC]member

preg_match("/^[-0-9A-Z_@\s[]~|]+$/i", $username) 
(( this is not working)):|
Edited by TabbeN on 19-03-2007 19:48,
0 replies
W
WEC
W
WEC 10
  • Veteran Member, joined since
  • Contributed 946 posts on the community forums.
  • Started 5 threads in the forums
answered
Veteran Member

You need to escape reserved characters like:

Quote

* ^ (carat)
* . (period)
* [ (left bracket}
* $ (dollar sign)
* ( (left parenthesis)
* ) (right parenthesis)
* | (pipe)
* * (asterisk)
* + (plus symbol)
* ? (question mark)
* { (left curly bracket, or left brace)
* \ backslash


Have in mind that changing the allowed characters will make your site less secure.
0 replies
T
TabbeN
T
TabbeN 10
  • Newbie, joined since
  • Contributed 3 posts on the community forums.
answered
Newbie

Im a nuub lol..
how do i escape reserved characters.
0 replies
W
WEC
W
WEC 10
  • Veteran Member, joined since
  • Contributed 946 posts on the community forums.
  • Started 5 threads in the forums
answered
Veteran Member

Try with a \ but it can be tricky at times.
0 replies
T
TabbeN
T
TabbeN 10
  • Newbie, joined since
  • Contributed 3 posts on the community forums.
answered
Newbie

aha now i get it i think.. thx m8
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 13 posts
  • Votes 0 votes
  • Topic users 8 members

0 participants

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet