Hi Guys,
I am working on an application where we need to have each user input unique email id. Now, the problem is with gmail IDs. In gmail username@gmail is same as user.name@gmail.com which is again same as use.r.name@gmail.com.
Now, how to make sure that only one of a kind of email id is allowed. I am storing the email IDs in the database. Should, I be using a query involving LIKE ? Please suggest.
Checking similar gmail email ids
Moderator: General Moderators
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Checking similar gmail email ids
Before storing them in the database, or querying for them, strip out all dots from the local part of the email address.
(cite for that Gmail-specific normalization here: http://en.wikipedia.org/wiki/Email_addr ... malization)
Code: Select all
$email = 'john.doe@gmail.com';
$localLength = strpos($email, '@');
$email = substr_replace($email, str_replace('.', '', substr($email, 0, $localLength)), 0, $localLength);
// $email == 'johndoe@gmail.com'