1. Welcome to PHCorner Forums. Take a moment to Sign up and gain unlimited access and extra privileges that guests are not entitled to, such as:

    All that and more! Registration is quick, simple and absolutely free. Join our community today!

PHP Bad words filtering

Discussion in 'Coding, Programming' started by dabxiiz30, Dec 13, 2014.

  1. Penge namang code jan na nagpifilter sa bad words ng comment ng user, or any suggestion po
    Salamat, more power :D
    arfbig likes this.
  2. Draft

    Draft Administrator Staff Member Administrator

    Please or Register to view links

    BOO Censorship!
    I hate censorship as much as anyone, but as a web application developer, there are times when a banned-word list is necessary, especially if the application or site is geared towards younger users or corporate environments.

    What This Script Does
    The script will take a word or phrase and replace the words you put in the $badwords array and replace it with asterisks.

    • Case insensitive
    • Looks for "leetspeak"-style combinations of foreign characters, numbers and symbols
    • Uses regex, so your badword list stays short
    • Uses asterisks as the replacement, but you can specify your own character
    • Add as many bad words as you like
    I haven't finished all of the leetspeak filters yet, but I have a good start so far. If you wish to twiddle those to add or remove, they can be found in the censor.function.php file in the master branch, in the $leet_replace array.
    dabxiiz30 likes this.
Tags / Keywords: