Here is an example of a simple word filter -
$host = '';
$usr = '';
$pswd = '';
$db_name = '';
$db = mysql_pconnect($host, $usr, $pswd) or die('Failed to connect to server: ' . mysql_error());
mysql_select_db($db_name) or die('Failed to select db: ' . mysql_error());
// the "i" after the pattern delimiter indicates a case-insensitive search
// the \b in the pattern indicates a word boundary, so only the distinct
// word "$word" is matched, and not a word partial like "$word"ing
sql = "SELECT words FROM profanity";
$res = mysql_query($sql);
while($row = mysql_fetch_array($res)) {
$word = $row['words'];
if(preg_match ("/\b$word\b/i", $content))
$flagged = 1;
}
if($flagged == 1) {
print 'some error text';
exit;
}
Post the code you've got relating to your first question and I'll have a look. 😉