Jump to content

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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.