HELP! is there some sort of LIKE Condition in PHP.

Discussion in 'PHP' started by skbytes, Jan 13, 2010.

  1. #1
    Hi Guys I hope you can help,

    I'm trying to stop SPAM on my website, as some of it fills up my inbox on my web host. I have around 5 users a day trying this spam method.

    All I'm looking for is a simple IF stement with a LIKE condition on the end (see below). I've looked into PHP tutorials and I dont see a LIKE condition.

    IF "new_user_email" like "@mywebsite.com" then
    return false;
    END IF;

    As you well know you can use anything before @mywebsite.com for it to end up in your inbox. If you need anymore info then let me know.

    thanks....
     
    skbytes, Jan 13, 2010 IP
  2. Sky AK47

    Sky AK47 Member

    Messages:
    298
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    45
    #2
    Is this PHP? xD
    if(preg_match("/@mywebsite.com/i", $new_email)){
    	RETURN FALSE;
    }
    PHP:
     
    Sky AK47, Jan 13, 2010 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    This should be the most efficient way to perform this.

    
    if(strpos($email,'@mywebsite.com') !== false) {
    return false;
    }
    
    PHP:
     
    jestep, Jan 13, 2010 IP