Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for a PHP regex or function to filter variations using . of an email for security

I am getting spam due to gmail allowing the use of . in their emails, so someone like this spammer.

[email protected] 

can get through by removing and/or adding another period in his naming structure. This happens to be on a Joomla install, so I am specifically looking to create a component so I can add to multiple sites, or if there is a simple regex to add inline existing code. Also, is there anything being done about this, as this seems to be along the lines of and be newly termed a loosely typed email address.. that is crazy to me.

like image 732
Shane Avatar asked Dec 26 '12 16:12

Shane


1 Answers

If your goal is to match this address against the others that are equivalent to it (because you've already got them blacklisted) then I'd simply normalize the address to it's most basic state before storing it. Lower case it, split it at the @, and if the right side is "gmail.com" then remove all dots from the left side and put the halves back together.

  1. start with [email protected]
  2. lowercase to [email protected]
  3. split to joe.schmoe and gmail.com
  4. since right side is gmail.com, remove dots from left
  5. reassemble to [email protected]

Now you've got the base address that you can block/ban/whatever.

like image 54
Alex Howansky Avatar answered Sep 28 '22 06:09

Alex Howansky