vBulletin Anti-Spam Hack
This is a quick and dirty hack for vBulletin to cut down on spammers. If a user's first post contains 'http', 'www', or 'www ', the post is automatically moderated, and the post content is posted on a thread of your choice (I find it useful to be able to monitor which posts the hack is moderating, in case of false alarms).
Of course there's nothing to stop a spammer from making a legitimate first post, then spamming; but from experience it seems to be enough to deter the majority of spammers (or you could just firewall off China).
The code goes in includes/functions_newpost.php, around line 353 in vBulletin 3.7.1, just after:
else
{
$dataman->set('visible', 1);
$post['visible'] = 1;
}
, and before:
if ($type != 'thread')
{
if ($postinfo['postid'] == 0)
{
Here's the code:
if ($vbulletin->userinfo['posts'] == 0) {
if ((strpos($post['message'], "http") > 0) || (strpos($post['message'], "www.") > 0) || (strpos($post['message'], "www ") > 0) ) {
$dataman->set('visible', 0);
$post['visible'] = 0;
$pete_post = "The following post by [URL=\"/forum/member.php?u=" . $vbulletin->userinfo['userid'] . "\"]" .
$vbulletin->userinfo['username'] . "[/URL] has been auto-unapproved:
[QUOTE]" . $post['message'] . "[/QUOTE]\n";
$vbulletin->db->query_write("INSERT INTO post (threadid, parentid, username,userid, pagetext, dateline, visible) VALUES
(162262, 0, 'bot', 183720, \"" . mysql_escape_string($pete_post) . "\", " . time() . ", 1)");
$vbulletin->db->query_write("UPDATE thread SET replycount=replycount + 1 WHERE threadid='162262'");
}
}
You'll need to change 162262 to the numeric ID of the thread on which you wish notifications to be posted, and 'bot' and 183720 to the username and user ID of the user
under which these posts should appear.
Services
Code
- Ghoti: IRC Client for X11
- Dialog Quiz
- Apache Fingerprinting: mod_pof
- mod_miserable (Apache)
- Website Performance Testing
- Firefox Toolbar Tutorial
- SEO Postcodes (OS Commerce)
vBulletin
Data
Fun Stuff
pete@linuxbox.co.uk
Linuxbox.co.uk