Steppio Posted February 15, 2008 Share Posted February 15, 2008 I've been building a website lately that will have alot of comments from users coming across and was just wondering if anybody has ever heard of a bad/undesirable language filter/template that i could read up on and possibly manipulate into my own webpage. If you've ever heard of anything like this i would be more than grateful if you could help me out. Thanks in advance. Steppio. Quote Link to comment Share on other sites More sharing options...
micah1701 Posted February 15, 2008 Share Posted February 15, 2008 check out php.net/preg_replace <?php $badWords = array("/poo/","/fart/","/stinkyhead/","/etc/"); $string = "here is my poo text string of stinkyhead words"; $string = preg_replace($badWords,'bleep',$string); echo $string; // returns: here is my bleep text string of bleep words ?> Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 15, 2008 Share Posted February 15, 2008 This may be a surprise for you but: http://www.google.com/search?q=bad+word+filter+in+php&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a Google "bad word filter in php", its quite amazing. Quote Link to comment Share on other sites More sharing options...
Steppio Posted February 15, 2008 Author Share Posted February 15, 2008 Try typing 'PHP Bad Language Filter' or 'PHP Undesirable Language Filter', its equally amazing, smart ar$e. Quote Link to comment Share on other sites More sharing options...
Steppio Posted February 15, 2008 Author Share Posted February 15, 2008 Thanks very much for the information, i believe i will be able to build a suitable array for the website with that example. Wheres that solved button... Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 15, 2008 Share Posted February 15, 2008 Yeah, if it is equally amazing then how come you needed us to post code for you? If you click the link I provided, first result has a perfect explanation on how to do what you wanted.. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted February 15, 2008 Share Posted February 15, 2008 Here is my method, simple: CASE SENSITIVE <?php $words = 'your a shit, because your a ASShole'; $badwords = preg_replace('/(?i:asshole|shit|word3)/','***',$words); echo $badwords; ?> Quote Link to comment Share on other sites More sharing options...
Steppio Posted February 16, 2008 Author Share Posted February 16, 2008 aebstract - if you look at my original message you'll see i didn't ask for any code, i asked if anyone had seen or had any information that could help me. I tried searching for 'PHP Bad Language filter'/'PHP Undesirable Language Filter' which both came up with nothing. I asked for help and phpSensei gave it to me, you gave me sarcasm and a bad attitude. If you feel the need to insult peoples intelligence everytime they ask for help, maybe help forums aren't for you. Thanks to everybody else Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.