Jump to content

maggotondlus

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

maggotondlus's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi everyone... Please help me on this one... I just finished a script that will check if a string or an array of strings contains offensive/swear words. Now my problem is how can I match a string containing spaces (i.e S H I T) with the bad word saved in my database (i.e shit)? I am having trouble with this. Can anyone help me please.. Thanks! Here's the function that I did: [code] function swear_checker($sc_string) {     if (!is_array($sc_string)) return "Error: Data not an array";     $query = "SELECT   table.swear_checker.sc_word                 FROM     table.swear_checker                 ORDER BY table.swear_checker.sc_id";     $result = mysql_query($query) or die(mysql_error());     $rl = mysql_num_rows($result);     foreach ($sc_string as $key => $value) {         $arrayVal[] = $value;     }     while ($rs = mysql_fetch_array($result)) {         foreach( $arrayVal as $key => $value) {             $match = ereg_replace($rs[sc_word], "****", $value);             if ($match != $value) {                 return false;             } else {                 $string = $sc_string;             }         }         }     return true;     } [/code]
×
×
  • 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.