Jump to content

Help with word filter


EchoFool

Recommended Posts

Hey,

 

I have a word filter which is dectecting strings that are only embedded in words. Which i don't want it to do.

 

For example:

 

If i want to filter "FR" and some one puts france - it flags it because france contains FR.

 

How do i make it only look for "FR" on its own seperated from a word instead of it flagging nearly all words with the two letters together?

 

Heres my filter:

 

 

$text = 'testing';  //this should not return 1
  // fill this array with the bad words you want to filter and their replacements
     $bads = array ("test");

                
foreach($bads as $key => $search_needle) {

   if(stristr($text, $search_needle) == TRUE) {
       return(1);
       break;
        }
    }

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.