so let me get this straight, you want to create a script that involves a list of keywords (in a string and separated by commas) and then you want them to be compared to an inputted text to see if the text contains any of them...
Well you could do this...
Adding URL websites for keywords would be more effective then just keywords...
$words = "one,two,three,four,five,six";
//Convert Keywords to array
$words = explode(',',$words);
$spam = false;
foreach($words as $w)
$spam = true;
When it comes down to preventing spam on a website, a simple keyword system wont do the job. You see having text like G.A.M.E.S or game(s) wont be considered spam (since its not within the keyword list). Also adding more keywords will only slow down the website. So to prevent spam you need to take a look at what kind of messages your spam users are sending.
Most of the time when the average spam user sends a message he or she will send the same message to multiple users, or maybe just alter a few things in the message (name, user, etc...). By using strcmp() you can compare the templated spam message (the old message) to the message that was inputted. By setting a ballpark percentage (say 80% then if the two messages are greater than 80% the same then they will be considered spam. So in order to do this, make a database system that flags the id of the last message that was sent by the user. Then once he/she sends another message it will compare the old message (fetched from the database via the flagged id) with the new inputted message. If both messages are above 80% (or any percentage that you specify) then it will be the same message or almost the same message. Then you know its SPAM.