Dragonfly CMS v9 ⇒ CPG-BB (forum) ⇒ Trigger email (or other action) on forum post keyword/phrase ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum Index Modules & Blocks CPG-BB (forum)

Trigger email (or other action) on forum post keyword/phrase Reply to topic


Unfortunately I need to revisit this topic because the spammers (both human and bot) are up to their old tricks again!

First thing to say, though, is that greenday2k's original spam trap discussed earlier in this thread still works really well and catches the majority of stuff we usually see. Unfortunately it's no good at identifying stuff we haven't seen before because it relies on an existing list of keywords (although we do keep that up to date).

I'm wary of turning flood protection on because I haven't had a great experience with it previously and I really don't want *any* false positives for the other, non-forum, pages. Also, a solution needs to work for DF 9.2.1 because there's absolutely no prospect of upgrading to anything else at the moment I'm afraid.

I've been trying to think of a simple test which wouldn't involve creating new tables etc. to track and analyse user activity and it occurred to me that just checking if a new user (new = registered in the last 24 hours) has posted more than 10 forum topics in that 24 hour period after registration would probably identify all of our spammers with no false positives (our forums are generally very quiet and new users usually only post one or two messages immediately after registering). Can I ask the esteemed elder members here if that makes sense and seems feasible? Would it involve just a single query for each new post? If so, I'm thinking that's something which I could just add to greenday2k's original solution such that each post is checked for both spam keywords and whether or not it's hit the post limit for new users.

Does that make some sense or am I barking up the wrong tree? Thougths appreciated!

Note: WWW Private Listing - Staff Only

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
linux/Apache 2.4.27/MySQL 10.1.26-MariaDB/PHP 5.2.17/Dragonfly 9.2.1


Spam is also on this website using v10 (yes still).
But we get only 1 per month!

This means 2 things:
- the new protection seems to reduce spam
- new users seem to post 1-2 messages, which makes your idea not that good.

Another solution might be that posts from new users are only visible to logged in users for 1 week.
This way bots don't index them.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial


Hi DJ,

Glad to hear the new spam system is working well but, for a variety of reasons, there's no prospect of us upgrading at the moment to take advantage of any new functionality.

Not sure I follow the comment about new users posting 1-2 messages but perhaps that's because I left out a crucial piece of information in my last post (D'oh!) - I forgot to mention that the spam problem we're trying to address isn't related to single spam posts (those we can delete if we see them and aren't a huge problem) but instead relates to 10s if not 100s of messages within a short space of time, either in one forum or spread across all our forums. Those take a long, long time to delete by hand and we really need to get rid of them because forum posts get picked up via RSS feeds and emailed out to our members.

Note: WWW Private Listing - Staff Only

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
linux/Apache 2.4.27/MySQL 10.1.26-MariaDB/PHP 5.2.17/Dragonfly 9.2.1


DJ Maze wrote

- new users seem to post 1-2 messages, which makes your idea not that good.

True, but I have seen 1 post used to 'test' the system, and then they are back to post en-mass the next day/night if you didn't catch it.

DJ Maze wrote

Another solution might be that posts from new users are only visible to logged in users for 1 week.
This way bots don't index them.

This seems as if it could be quite useful. At least containing the issue. Any idea on how to implement this efficiently - on v9? TIA

macavity wrote
... just checking if a new user (new = registered in the last 24 hours) has posted more than 10 forum topics in that 24 hour period after registration ...

Especially in it could be combined with a post limit for new users on their first day as suggested by macavity.

Pro_News CM™ - Content Management for Dragonfly CMS™

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / 1.3.39 - 2.4.9 / 5.5.42 - 5.6.16 / 5.4.37 - 5.5.11 / 9.4

Last edited by layingback on Thu Aug 20, 2015 1:07 pm; edited 1 time in total


layingback wrote

DJ Maze wrote

Another solution might be that posts from new users are only visible to logged in users for 1 week.
This way bots don't index them.

This seems as if it could be quite useful. At least containing the issue. Any idea on how to implement this efficiently - on v9? TIA


Something like this in viewtopic.php
} else { $total_replies = intval($forum_topic_data['topic_replies']) + 1; $limit_posts_time = ''; $post_days = 0; }
Replace with:
} else { $total_replies = intval($forum_topic_data['topic_replies']) + 1; $limit_posts_time = ''; $post_days = 0; } if (!is_user()) { $age = time() - 86400 * 7; // 7 days $limit_posts_time .= " AND u.user_regdate < {$age}"; }

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial

Last edited by DJ Maze on Thu Aug 20, 2015 8:21 pm; edited 3 times in total


Thanks. Clever use of $limit_posts_time! Smile

Note for others this only works for new user replies. For new user new posts a similar change is required in viewforum.php

Find} else { $topics_count = ($forum_row['forum_topics']) ? $forum_row['forum_topics'] : 1; $limit_topics_time = ''; $topic_days = 0; }
and replace with} else { $topics_count = ($forum_row['forum_topics']) ? $forum_row['forum_topics'] : 1; $limit_topics_time = ''; $topic_days = 0; } if (!is_user()) { $age = time() - 86400 * 7; // 7 days $limit_topics_time .= " AND u.user_regdate < {$age}"; }
Note that new user's reply still shows in viewforums, but I'm not concerned.

Also note you may also need similar mods to RSS and any Forums blocks to completely hide it from search engines.

@DJMaze, feedback on this site: New version of code BBCode doesn't allow simple copy and paste into an editor (geany on linux in my case) as the line breaks are all lost.

Pro_News CM™ - Content Management for Dragonfly CMS™

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / 1.3.39 - 2.4.9 / 5.5.42 - 5.6.16 / 5.4.37 - 5.5.11 / 9.4


layingback wrote
@DJMaze, feedback on this site: New version of code BBCode doesn't allow simple copy and paste into an editor (geany on linux in my case) as the line breaks are all lost.


Works here fine in Geany on KDE GNU/Linux using Klipper.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial


Sorry guys, I missed the last few posts, just catching up now. If I understand correctly, the above implements DJ's idea such that "posts from new users are only visible to logged in users for 1 week"? I see the use in that but I'm still keen to have something in place which notifies me if a new user starts posting an unusually large number of posts after registering.

I've come up with the following (hacked together from greenday2k's earlier code and some other stuff I managed to find) which aims to send me a message if a user posts more than 10 times within 24 hours of registering:

if (($userinfo['user_regdate'] > (time() - 60*60*24)) && ($userinfo['user_posts'] > 10)) {
$mail_message = $userinfo['username']. ' may have posted spam. USER ID: '. $userinfo['user_id']. $post_subject. $post_message;
send_mail($spamsucks, $mail_message, 0, 'Subject line', 'myemail@mysite.com', 'Admin', 'myemail@mysite.com', $from_name='My name', false);
}

It *almost* works but not quite - I think the problem is that the value for $userinfo['user_posts'] is only set once, presumably when the user logs in, and isn't updated after each post, which I guess it needs to be, otherwise a new user could log in with 0 posts and post as many times as they want without triggering the email. Assuming that's the case, can anyone tell me how I update the value of $userinfo['user_posts'] each time someone posts and this check takes place?

Note: WWW Private Listing - Staff Only

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
linux/Apache 2.4.27/MySQL 10.1.26-MariaDB/PHP 5.2.17/Dragonfly 9.2.1

Last edited by macavity on Sun Aug 23, 2015 2:19 pm; edited 1 time in total

All times are UTC


Jump to: