CodeKing
Mar 2 2007, 08:27 PM
I made a guestbook for one of my clients, and there was inappropiate post. How can I search a string for certain words? I want to make a simple filter.
Darin McGrew
Mar 2 2007, 08:44 PM
What guestbook software are you using? Does it already have any filters (spam, offensive words, etc.)? How comfortable are you programming in whatever language the guestbook software is written in?
But ultimately, you'll need a human moderator. Filt3rs c@n on1y d0 $o muİh...
pandy
Mar 2 2007, 09:22 PM
Some filters are mean and filter totally appropriate words in Swedish.
CodeKing
Mar 3 2007, 10:07 AM
I MADE a guestbook for one of my clients, I did not use pre-programmed PHP. I still want to know if there's a string search function. And also, there will be a moderator, but to prevent most of the junk posts I want a filter.
P.S. I forgot to mention, I programmed the guestbook in PHP, so a PHP function would be nice.
Christian J
Mar 3 2007, 12:49 PM
You can make an array of the forbidden words, then loop through it, each time using str_replace(). This may not catch letters made by HTML entities.
Google should turn up plenty of more elaborate code examples.
Peter1968
Mar 3 2007, 10:07 PM
There are also canned spam and obsenity filters made for a bunch of apps. I've seen them for Mediawiki, PostNuke, phpBB, etc, so I'm sure if you Google for them, you'll find something.
CodeKing
Mar 7 2007, 06:55 PM
I don't want a prewritten PHP file for my filter, I would prefer to custom-make the filter. Is there a function that searches a string and returns true if it found something? (replace won't work, I want to not let a inappropiate post to be posted, rather than starring out the bad words)
Christian J
Mar 7 2007, 07:38 PM
QUOTE(CodeKing @ Mar 8 2007, 12:55 AM)

replace won't work, I want to not let a inappropiate post to be posted, rather than starring out the bad words
http://php.net/manual/en/function.strpos.php then?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.