Page 2 of 2

Re: Preventing like user names: your suggestions please.

Posted: Mon Sep 15, 2008 2:46 am
by webaddict
JAB Creations wrote:In example "JAB Creations" and "jabcreations" are essentially the same thing though I want to prevent this to preserve the uniqueness of each user name.
Sorry in advance for not answering your question, but why would you want to do the above? If you want the username to be unique, just make sure it is unique. I can not imagine in which context it would be helpful to decline a certain username because an existing one looks like it.

"JAB Creations" and "jabcreations" are not essentially the same thing, they are very different. I can image a policy that states that only [a-z] is allowed would do the same? Forgive me my ignorance; I just don't see why you're creating a problem that doesn't exist?

Just a quick example to justify my twadling above: taking a person named "Simon Eduard Gent" (yes, that could happen in the Netherlands ;)) with username "SE Gent". Now take another person named "Simon Egent", with the username "S Egent". See how that would form a problem? If you want to allow capital letters and spaces, don't strip them later?

Re: Preventing like user names: your suggestions please.

Posted: Mon Sep 15, 2008 3:00 am
by onion2k
I'd use MySQL's SOUNDEX() function. Eg

Code: Select all

SELECT `user_id` FROM `users` WHERE SOUNDEX(`username`) = SOUNDEX("jabcreations")
Similar sounding usernames will return the same value because they sound alike.. for example, "jabcreations" and "Jab creations" both return "J126352" so they'd match. "webaddict" and "webaddikt" both return "W1323" so they'd match too. It'll stop people posing as someone already on the site. But, and this could be a problem, it will fall over on 'hax0r' spellings ... "onion" and "0n10n" will not match (although minor changes are found ... "onion" and "on1on" do match).

Re: Preventing like user names: your suggestions please.

Posted: Mon Sep 15, 2008 3:33 am
by Zoxive
Most sites these days limit to what can be in the username. ex. [a-z0-9_-]
Basically once you limit the usernames with somes rules, then it becomes easier to see if that username already exists.

However there is some great advice in this thread for finding usernames that sound alike and/or are similar.

Re: Preventing like user names: your suggestions please.

Posted: Mon Sep 15, 2008 8:29 am
by VladSun
JAB Creations wrote:However I only see trim() and it only removes starting and ending whitespace. Are there any other functions not listed here that would remove all white spaces? Google isn't being very helpful with this particular question. :|
Jab... http://dev.mysql.com/doc/refman/5.0/en/ ... on_replace ?

Re: Preventing like user names: your suggestions please.

Posted: Mon Sep 15, 2008 5:57 pm
by JAB Creations
I currently have a maximum number of 32 characters allowed for user names. If I had a million users that would be roughly 32 megabytes of user names worst case scenario, though what is the average length of a user name? I don't think having a second column of user names minus the letter casing and spaces to be used simply for preventing nearly identical user names would be too detrimental, especially since this is only done during registration. Additionally pretty much everything else is executed before the regex is thus reducing the overall likelihood of unnecessary queries. Plus with VladSun's awesome recommendation about using The Regex Coach I'm now able to test and reduce the number of steps (and thus server load) of my regex filters by using it's double highlighting feature in the steps tab. In example on a three letter string I was able to reduce the number of steps from 20 to 10 by adjusting my a regex string; I'm sure that would have a noticeably positive effect on server performance! Frankly if my work ever started getting so large as the server load from just registration was beginning to become detrimental I would hope that I would be able to afford a second cheaper server that I could assign to registration to a sub-domain on a separate server as from my current understanding large websites (such as Google and Microsoft) just can not be run on a single machine. Oh how I can't wait to be asking the questions here associated with that sort of setup! :twisted:

Re: Preventing like user names: your suggestions please.

Posted: Tue Sep 16, 2008 6:09 am
by VladSun
JAB Creations wrote:... Plus with VladSun's awesome recommendation about using The Regex Coach ...
You should thank Kieran Huggins, I think. This link was in his signature as far as I remember.

Re: Preventing like user names: your suggestions please.

Posted: Tue Sep 16, 2008 3:16 pm
by JAB Creations
Where has he been of late? :| I checked his profile, he has something different linked? Maybe his tastes have changed?