Well, you need to think about specifically step by step how to alter the text.
A simple bad word filter is incredibly simple... just replace [word] with [] or [****], etc.
$string = str_replace('findword','replaceword_orblank',$string);
Efficiently, you could use an array-- array('word1','word2','word3') -- and place the replace within a foreach loop, removing each word.
You may also want to consider placement-- hello contains hell; you may want to check that there is a space or other punctuation on either side of the word.
Replacing links wouldn't be all that hard--
You could use regex, or you could use a less efficient/simpler (but more complex statements) method with substr, etc.
PHP Code:
while (strpos('http://',$string)!==FALSE) {
$string = substr($string,0,strpos($string,'http://')).substr($string,strpos($string,' ',strpos($string,'http://'));
}
(Can't promise that'll work, but the concept is there-- and you should consider if that's exactly what you want anyway.)
And you can do some more, as well, though nothing you will do can get around human creativity, so you'll need to manually check the posts... yep. Ban those who post offensive comments if possible, as well.
A simple captcha or even just a question "what color is grass? [blue] [red] [green]" would also help with bots.
Your security doesn't need to be perfect if there isn't a real threat-- just some spam, and it is likely that the bots will give up rather than adapt as your site probably is not any particular benefit to them... they just search out forms and post.
Bookmarks