for security reasons i want the users on my website not to be able to register a username that resembles their email adress. Someone with email adress user@domain.com cant register as user or us.er, etc
For example i want this not to be possible:
tester -> tester@mydomain.com (wrong)
tes.ter -> tester@mydomain.com (wrong)
etc.
But i do want to be able to use the following:
tester6 -> tester@mydomain.com (good)
etc.
//edit
tester6 is wrong too. i ment user6 -> tester@mydomain.com (good).
Does anyone have an idea how to achieve this, or something as close as possible. I am checking this in javascript, and after that on the server in php.
Ciao!
ps. Maybe there is some jquery plugin to do this, i can’t find this so far. The downside tho of using a plugin for this, is that i have to implement the same in php. If it is a long plugin it will take some time to translate.
//Edit again
If i only check the part before the @ they can still use userhotmailcom, or usergmail, etc. If they supply that there email is abvious.
Typically, I use the Levenshtein distance algorithm to check whether a password looks like a login.
PHP has a native levenshtein function and here is one written in JavaScript.