homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Bad words filter
Bad word filter with php and mysql

 9:11 pm on May 15, 2004 (gmt 0)

How can i go about getting a bad words filter that uses mysql for ease of editing , deleting , and adding filter words
--Thanks in advance



 1:44 am on May 16, 2004 (gmt 0)

function edit_words($STRING,$bannedwords) {
foreach($bannedwords as $key => $v) {
$STRING = eregi_replace($v,"*@!\$",$STRING);
return $STRING;

//i don't know how to populate the list using mySQL, never used it
$words = array('this','that','and','the','other','thing');

// call it like this
$uneditedString = "hi, this and that and the other thing. yup!";
$edited = edit_words($uneditedString,$words);

hope this helps a little, i'm sure there are much better ways


 4:22 pm on May 19, 2004 (gmt 0)

MYSQL_QUERY (SELECT * FROM bad words list.....



for($x=0; $x< count($badWords); $x++)
$input = eregi_replace($badWords[$x], "****", $input);


Replaces bad words with **** in $input

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved