Print Thread
Forum Spam Detection
NetriX
Just a simple script that will search out excessive url postings in forum posts, most likely caused by spam agents.

The count can be altered to become more scrict in it's search.

This is the basic script to an entirely new addon I had been working on last year. Eventually it'll become part of an greater infusion to help the community.

[php]<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Developer: Brandon Davis (NetriX)
| Website: PHPFusionMods.com
| _ _ _ ___ __
| | \ | | ___| |_ _ __(_) \/ /
| | \| |/ _ \ __| '__| |\ /
| | |\ | __/ |_| | | |/ \
| |_| \_|\___|\__|_| |_/_/\_\
|
| Do not remove the copyright footer without the developers
| consent. You may request the consent of removal by contacting
| me at the following email address:
|
| Thank You,
| Brandon (NetriX)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../../maincore.php";
require_once THEMES . "templates/header.php";

opentable("Spam Blaster Control Center");
$query = dbquery("SELECT * FROM ".DB_POSTS."");
if (dbrows($query)) {
echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border center'>\n";
echo "<tr>\n<td class='forum-caption'></td><td class='forum-caption'><strong>Link Count</strong></td><td class='forum-caption'>User</td><td class='forum-caption'><strong>Content</strong></a></td></tr>";
while ($info = dbarray($query)) {

$count=preg_match_all("@[url [^>]+]@", $info['post_message'], $matches);

if ($count > 5) {
echo "<tr>";
echo "<td class='tbl2'></td>";
echo "<td class='tbl2'>{$count}</td>";
echo "<td class='tbl2'>Example Name</td>";
echo "<td class='tbl2'>".nl2br($info['post_message'])."</td>";;
echo "</tr>";
}

}
}
echo "</table>";
closetable();
require_once THEMES . "templates/footer.php";
?>[/php]

or just view in custom pages as:

[php]<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Developer: Brandon Davis (NetriX)
| Website: PHPFusionMods.com
| _ _ _ ___ __
| | \ | | ___| |_ _ __(_) \/ /
| | \| |/ _ \ __| '__| |\ /
| | |\ | __/ |_| | | |/ \
| |_| \_|\___|\__|_| |_/_/\_\
|
| Do not remove the copyright footer without the developers
| consent. You may request the consent of removal by contacting
| me at the following email address:
|
| Thank You,
| Brandon (NetriX)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/

opentable("Spam Blaster Control Center");
$query = dbquery("SELECT * FROM ".DB_POSTS."");
if (dbrows($query)) {
echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border center'>\n";
echo "<tr>\n<td class='forum-caption'></td><td class='forum-caption'><strong>Link Count</strong></td><td class='forum-caption'>User</td><td class='forum-caption'><strong>Content</strong></a></td></tr>";
while ($info = dbarray($query)) {

$count=preg_match_all("@[url [^>]+]@", $info['post_message'], $matches);

if ($count > 5) {
echo "<tr>";
echo "<td class='tbl2'></td>";
echo "<td class='tbl2'>{$count}</td>";
echo "<td class='tbl2'>Example Name</td>";
echo "<td class='tbl2'>".nl2br($info['post_message'])."</td>";;
echo "</tr>";
}

}
}
echo "</table>";
closetable();
?>[/php]
 
KasteR
Thank you sir!

EDIT: So this script is parsed once viewed. I'm thinking maybe cron job? Any thoughts from anyone? Correct me if I'm wrong. What does anyone else think?
Edited by KasteR on 03-07-2013 11:55
 
skpacman
This would do great as a cron, but I've never invoked/created cron through php on a web host before, so I have no idea how to do it.

But, yes, this would be awesome as a cron.

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
KasteR
Yeah, I'm thinking about removing the header/footer includes and running as a cron job.

It's actually simple, when using zpanel. Which is what I'm currently using.
 
Lenoox
I do not understand how it worked in the first part, should be insert somewhere? or custom page or what?

Sorry for the dumb answer Smile
 
KasteR
Lenoox, I believe this is just a script which NetriX provided, and may be used towards anything to be developed. I am going to implement this script to be ran as a cron job. So the script will be executed every now and then automatically (scheduled). Perhaps one could make this into a panel and display on pages they choose to.
 
Lenoox
ohh i undderstand Smile
Thanks so much Smile
 
NetriX
Spam bots like to post a lot of links in their forum posts. Whenever you receive your next spam attack, or come across another in an PHP-Fusion website, take note of how many links (URL's) exists.

This script reads all posts individually and counts the amount of links used and flagging the post as possible spam.

It just makes it easier to detect spam. Their are many ways this simple script can be adapted.
 
Lenoox
Thanks for the description Smile
 
Jump to Forum: