checking for spam comments function
with this function, you can scan through your incoming comments and check them for keywords
the function will scan through the comment text and then provide you with a score
as you get more spam comments, you can use them to make the function work better for you by adding the additional keywords that can trigger it
if you wanted to have a ton of keywords you can add them to a db table or just a massive global array
PHP
/* if the spam score is >=4 its probably spam... */
function spam_score($text){
$spam_score_val = 0;
$text = strtolower($text); // lowercase it to speed up the loop
$spam_words = array("http","peni","pills","sale","cheapest");
foreach($spam_words as $word){
$count = substr_count($text, $word);
$spam_score_val += 2 * $count;
}
return $spam_score_val;
}