I have someone that is placing data spam in my email subscription as the following pattern:

FirstnameLastName##@gmail.com
AnothernameAnotherName##@gmail.com
DifferentnameAnotherName##@gmail.com

where the ## is a random number (ex: 42)

So, some examples would be:

GeorgeWashington67 @ gmail.com
ThomasJefferson23 @ gmail.com
etc

I need to use either Regex or PregMatch in my filter to identify the ##@gmail.com to prevent it from being entered into the database.

I appreciate help here because it involves this plus an array to cover 0-9,0-9 or 00-99

Thanks

Marc

    I would appreciate some help. Its pretty simple for someone who knows PHP really well.

    People are entering false emails on a form. The PHP variable for the email they submit is '$submit_by'

    Before it is entered into the MYSQL database, I need PHP to qualify it does not have a ## @ gmail.com at the end of it.

    is a number from 00 to 99

    I was looking through arrays, regex and preg_match.

    Thee fact that the number entered (##) could be anywhere from 00 to 99,
    combined with the fact that it the query will look at the end of the field threw me off.

    $submit_by='phpbuilder @ gmail.com' would not get flagged
    $submit_by='phpbuilder1 @ gmail.com' would not get flagged
    $submit_by='randomuser44 @ phpbuilder.com' would not get flagged

    but.....

    $submit_by='phpbuilder67 @ gmail.com' would get flagged.

    Any help here.....please!

    Marc

      You can't do that. Reason being is that I have a gmail account (a few actually) and all of them are in the format of {name}{number}@gmail.com. So if you put this in place, I'd be filtered out 🙁

      The best thing to do is to actually put in a verification track. Either send an email with a verification code, or require your users to register. But simply blocking all users with a {name}{number}@gmail.com address is going to block a lot of users.

      Anyway, a regex would be something like:

      ~[a-zA-Z]+[0-9]{1,2}@gmail\.com~

      But that would block lots of email addresses. I'd suggest following my above recommendations. Implement a login system, or require an email validation.

        I looked at most of our emails that people submit. Most are corporate emails. Very few are 2 digit @ gmail.com addresses. So while I may miss a few....I would rather stop the hordes of spam that are coming in now.

        Any help here.. thanks.

        Plus, your [1,2] I don't understand....is any thing from 00 to 99, not 01 to 92

        Marc

          if(preg_match('/.+\d\d@gmail.com/i', $submit_by))
          

          Of course, once that person gets regjected, it will be a trivial change to his script to generate a different email address pattern, and then there will be the possibility of rejecting valid users who happen to have an email address that matches this pattern.

            Remember to mark this thread as resolved (if it is*) using the thread tools.

            • and it may not be, for the reason outlined: having your valid email address blocked for no good reason is very, very irritating.
              Write a Reply...