Here's how to filter out bad words:
This is probably the least elegant way but will work, you can use the PHP string replace function. Place this on the first couple lines of the script:
$Comments = str_replace("Shit", "", $Comments);
This is the basic idea - it will replace Shit with nothing if you want to do a search and replace you can use something like this:
$Comments = str_replace("Shit", "****", $Comments);
With the above any occurance of the characters Shit will be replaced by ****
You can just add the ones you want to replace line by line, for example:
$Comments = str_replace("Crap", "****", $Comments);
Note that str_replace(); replace is case sensitive - which will cause problems.
An incase sensitive alternative would be to use the eregi function:
$Comments = eregi_replace("Shit", "****", $Comments);
This function is slower then the str_replace function but you probably will not notice it.
For more information:
http://www.php.net/manual/en/function.eregi-replace.phpand
http://www.php.net/manual/en/function.str-replace.php But eventually you'll want to but all the bad words into an array then loop through this function replacing each one all at once.