Jump to content

Checking text field for spam words


chrishau

Recommended Posts

Hey! I have a problem... I have a tagboard on my homepage - www.dagangstas.net and it constantly gets filled up with spam so I deciced to do something about it and I want to create a filter that checks the tags for spam words. But I am not sure how.. Here is what I have so far!

[code]
$cjmsg = $_POST['cjmsg'];
$spam_array = array('breast enlargement', 'penis enlargement', 'weight loss', 'Incest Sex', 'Hentai Porn', 'Lose Weight', 'Free Money', 'Credit card', 'green card lottery', 'Viagra');

function contains_spam($spam_array,$cjmsg) {
foreach ($spam_array as $spamitem) {

return true;
}
return false;
}
[/code]

As you can see the spam_array contains the words I want to ban and $cjmsg contains the tag. How can I check the words in $cjmsg against the spam array? Any help would be appreciated!! :)
Link to comment
https://forums.phpfreaks.com/topic/24308-checking-text-field-for-spam-words/
Share on other sites

[code]
$cjmsg = $_POST['cjmsg'];
$spam_array = array('breast enlargement', 'penis enlargement', 'weight loss', 'Incest Sex', 'Hentai Porn', 'Lose Weight', 'Free Money', 'Credit card', 'green card lottery', 'Viagra');

if (in_array($cjmsg, $spam_array)) {
  // prevent update
} else {
  // do the update
}
[/code]

though you should know..that's about as rudimentary as it comes... people can do all sorts of things to get around that, like doing V i a g a r a V..I..A..G..A..R..A  etc..  so you're going to have to do better than that..
If you want to be really fancy you can send any board posts as an email to your webserver (with subject line: board_post or some such) and let your spam software (spamassassin, etc) sort it out. Then collect the email with a cronjob and post it.

Have a Google around and see if any anti-spam tools are out there that you can use on plain-text. There must be a few.

Otherwise just ban the IPs of the people who are posting spam.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.