Thread: bad word filter

Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default bad word filter

    ZenCart v1.5.5e
    Apache server (Hostmatters)
    PHP 5.6.31 (Zend: 2.6.0)
    MySQL 5.6.37
    About_us page
    dbio 1.3.0
    MainImageReplacer-v1.0
    Image_Handler4_v4.3.2

    This seemed as good a spot as any for this post. If not, just remember that I am a senile old man.

    I was looking around for a bad word filter for my CAPTCHA with very little luck. The consensus seemed to be that it was too rare a scenario for anyone to be bothered with. Personally, I have very little traffic as of yet and I would hate to lose one customer (plus word of mouth) because 'mother dog' (I got censored) showed up in my CAPTCHA box as some little old lady was looking to buy my antique doll.

    so for anyone that wants it, here it is. I used the Google 'bad word list' for my database. It is a very simple filter so even words like grass and sassy will be filtered.

    PHP Code:
    <?php

        
    function bad_word($word)

            
    //---- open bad_word db here ----//
            
            
    require ("local_db_conn.php");
            
            
    $word_table"bad";
            
    $bad_word"words";
            
    $captcha_ID "ID";
            
    $word strtoupper($word);
            
            
    $query "SELECT $bad_word from $word_table";
            
            if (
    $result $conn->query($query))
            {
                
    /* fetch object array */
                
    while ($row $result->fetch_row())
                {
                    
    $google strtoupper($row[0]);

                    if (
    strstr($word,$google))
                    {
                        
    $word "";
                        goto 
    done;
                    }
                }
            }

        
    done:

            
    /* free result set */
            
    $result->close();

            
    /* close database */
            
    mysqli_close($conn);

        return(
    $word)
    ?>

  2. #2
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: bad word filter

    FWIW (keeping in mind that I'm not exactly a spring chicken), I boycott any site that uses CAPTCHA. My time is more important to me than a merchants dislike of spam. Even if I did get the captcha right the 1st time (never happens) it still sucks a little more of my life away.... and dont get me started on "bad word" filters... with a surname of "Gasson" and "######" often considered to be a "bad word" you can only imagine the trouble I have with some sites.

    Just sayin'

  3. #3
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: bad word filter

    LOL.. seems that even this forum considers another name for donkey to be a bad word... thankfully it didnt filter the same word embeded in my name as being bad.

  4. #4
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default Re: bad word filter

    I have been to quite a few forums that would censor your surname. I was on a car forum and it did not like Matsushita. WIKI -
    Matsushita (written: 松下 lit. "below the pine tree") is a Japanese surname. Notable people with the surname include ...

 

 

Similar Threads

  1. Replies: 3
    Last Post: 11 May 2012, 12:35 PM
  2. Word HEADER_ bin the menu bar and after the word login
    By moro in forum Installing on a Windows Server
    Replies: 1
    Last Post: 18 Dec 2011, 03:14 PM
  3. Replies: 0
    Last Post: 19 Jan 2010, 07:58 PM
  4. Word "array" displayed after every item in cart (TemplateMonster template bad)
    By thailandunique in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 29 Apr 2007, 10:14 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR