[ABD] Invisible Spammer Mod 0.3 Updated 4/30

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
DarKnight
Registered User
Posts: 26
Joined: Mon Aug 18, 2003 7:56 am

[ABD] Invisible Spammer Mod 0.3 Updated 4/30

Post by DarKnight »

Hey everyone,

Are you tired of users who seem to fill your forum with garbage/spam? This little mod will make posts of a particular user invisible. It is useful for controlling (to a certain degree) the chaos caused by spammers with dynamic IPs. It makes all posts and topics viewable to the offender when he/she logs on but not to other members of the forum.
ADMINS can see invisible posts and have full control over who gets 'invisModed' or not.

FEATURES:
- color coding and labeling of topics AND posts that are invisible [Admin view]
- Last topic/forum poster is updated so that invisible posts are not counted
- List of invis'd users is provided in the Admin Control Panel
- Easy to invis a user. Simply enter a user's name in the user management console and select 'yes' to make user invis'd.
- other members will NOT see the invis'd posts

Problems:
- If search is used, any post will be returned, including posts that are invisible.
- no Groups implementation at the moment
- if problematic user logs off and views the forum he/she will find that their posts are 'missing'.

Check out the mod and please post your comments!

Enjoy!

Code: Select all

############################################################## 
## MOD Title: Invisible Spammer Mod (InvisMod) 
## MOD Author: DarKnight < [email protected] > (N/A) N/A
## MOD Description: The Mod allows the admin to hide all posts and topics of a particular
## user from other forum members.  It should be used to combat chronic spammers who uses dial-up to 
## constantly alter their internet protocol (IP) address.  
## MOD Version: 0.0.3 
## 
## Installation Level: Easy 
## Installation Time: ~15 Minutes 
## Files To Edit: 
## 		admin/admin_users.php 
## 		includes/functions_post.php 
## 		language/lang_english/lang_admin.php 
## 		templates/subSilver/admin/user_edit_body.tpl 
## 		templates/subSilver/admin/user_select_body.tpl
## 		viewforum.php 
## 		viewtopic.php
## 		index.php 
## Included Files: (n/a) 
############################################################## 

############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
############################################################## 

############################################################## 
## Author Notes: 
## Current Problems: 
## 1. Guest will not see invisModed Posts, thereby allowing an offender who logged off to realize
## something fishy is goin on.
## 2. MODS cannot see invisible posts
## 3. WARNINGS: Annoucements cannot be made invisible.
############################################################## 

############################################################## 
## MOD History: 
## 
##   2004-05-01 - Version 0.0.3
##      - Rewrote some code.  Making a user invisible should be consistent now. 
##		- Added a much needed feature.  Last poster of forum should be correctly identified now.
##
##   2003-09-01 - Version 0.0.2
##      - Fixed Bug where user Invisible status wasn't set in user table 
##		- Fixed Bug where, in certain situations, topics weren't showing
##
##   2003-08-20 - Version 0.0.1 
##      - Initial Beta Release 
## 
############################################################## 

############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 

# 
#-----[ SQL ]------------------------------------------ 
# 
alter table phpbb_posts add post_invis tinyint(1) default '0' not null after poster_id; 
alter table phpbb_topics add topic_invis tinyint(1) default '0' not null after topic_poster; 
alter table phpbb_topics add topic_replies_invis mediumint(8) unsigned default '0' not null after topic_replies;
alter table phpbb_users add user_invis tinyint(1) default '0' not null after user_id; 


#
#-----[ OPEN ]------------------------------------------ 
#
admin/admin_users.php


#
#-----[ FIND ]------------------------------------------ 
#
$user_status = ( !empty($HTTP_POST_VARS['user_status']) ) ? intval( $HTTP_POST_VARS['user_status'] ) : 0;	


# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
//InvisMod
$user_invis = ( !empty($HTTP_POST_VARS['user_invis']) ) ? intval( $HTTP_POST_VARS['user_invis'] ) : 0;
//InvisMod


#
#-----[ FIND ]------------------------------------------ 
#
if (!($this_userdata = get_userdata($user_id)))
{
	message_die(GENERAL_MESSAGE, $lang['No_user_id_specified'] );
}


# 
#-----[ AFTER, ADD ]------------------------------------------
#
//InvisMod
		
		//Get current Invis status of user
		$sql = " SELECT user_invis FROM " . USERS_TABLE ."
									WHERE user_id = $user_id";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Error getting Invisible Status of user', '', __LINE__, __FILE__, $sql);
		}
		$db_invis_status = $db->sql_fetchrow($result);
		
		//Execute code if user invis status changed and not just resubmitted
		if( $db_invis_status['user_invis'] == 0 && $user_invis == 1 || $db_invis_status['user_invis'] == 1 && $user_invis == 0)
		{
			if( $db_invis_status['user_invis'] == 0 && $user_invis == 1 )
			{
				$user_invis = 1;
			}
			else if( $db_invis_status['user_invis'] == 1 && $user_invis == 0 )
			{
				$user_invis = 0;
			}
			$sql = " UPDATE " . USERS_TABLE . "
					SET user_invis = $user_invis
					WHERE user_id = $user_id";
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Error updating Status of user', '', __LINE__, __FILE__, $sql);
			}
			
			//Update Posts Table
			$sql = " UPDATE " . POSTS_TABLE . " 
					SET post_invis = $user_invis
					WHERE poster_id = $user_id";
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Error setting Posts Invisible', '', __LINE__, __FILE__, $sql);
			}
			
			//Get number of topics that should be changed
			$sql = " SELECT count(distinct t.topic_id) AS topic_count FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
					WHERE p.poster_id = $user_id 
					AND p.topic_id = t.topic_id";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Error getting Topic count', '', __LINE__, __FILE__, $sql);
			}
			$result = $db->sql_fetchrow($result);
			$invis_topic_count = $result['topic_count'];
			
			//Get topics affected
			$sql = " SELECT distinct t.topic_id FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
					WHERE p.poster_id = $user_id 
					AND p.topic_id = t.topic_id";
			if ( !($result_topics_to_change = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Error getting Topic IDs', '', __LINE__, __FILE__, $sql);
			}
			$result = $db->sql_fetchrow($result_topics_to_change); //Get first topic affected
			$invis_topic = $result['topic_id'];
			
			//Update topic_replies_invis for each topic affected
			for( $x_invis = 0; $x_invis < $invis_topic_count; $x_invis++)
			{
				//Reset topic_replies_invis if user de'Invised, else modify as appropriate
				if( $user_invis )
				{
					//Get number of posts affected for particular topic
					$sql = " SELECT count(post_id) AS post_count FROM " . POSTS_TABLE . "
							WHERE poster_id = $user_id
							AND topic_id = $invis_topic";
					if ( !($result = $db->sql_query($sql)) )
					{
						message_die(GENERAL_ERROR, 'Error getting number of posts for Topic Update', '', __LINE__, __FILE__, $sql);
					}
					$result = $db->sql_fetchrow($result);
					$invis_post_count = $result['post_count'];
					
					//Check if any of the posts are topic starters and adjust replies as appropriate
					
					//Get posts
					$sql = " SELECT post_id FROM " . POSTS_TABLE . "
							WHERE poster_id = $user_id
							AND topic_id = $invis_topic";
					if ( !($result_post = $db->sql_query($sql)) )
					{
						message_die(GENERAL_ERROR, 'Error getting posts for Topic Update', '', __LINE__, __FILE__, $sql);
					}
					$result = $db->sql_fetchrow($result_post); //Get First post
					$invis_post = $result['post_id'];
					
					//Get topic_first_post_id for topic
					$sql = " SELECT topic_first_post_id FROM " . TOPICS_TABLE . "
							WHERE topic_id = $invis_topic";
					if ( !($result = $db->sql_query($sql)) )
					{
						message_die(GENERAL_ERROR, 'Error getting first post id for Topic Update', '', __LINE__, __FILE__, $sql);
					}
					$result = $db->sql_fetchrow($result_post); //Get First post
					$invis_first_post_id = $result['topic_first_post_id'];
					
					//Check each post and see if they are topic starter.  Decrease replies count if true.
					for( $y_invis = 0; $y_invis < $invis_post_count; $y_invis++ )
					{
						if( $invis_post == $invis_first_post_id )
						{
							$invis_post_count = $invis_post_count - 1;
						}
						$result = $db->sql_fetchrow($result_post); //Get next post
						$invis_first_post_id = $result['topic_first_post_id'];
					}
					
					$invis_query = "SET topic_replies_invis = topic_replies - " . $invis_post_count . "";
				}
				else
				{
					$invis_query = "SET topic_replies_invis = 0";
				}
				//Update topics_replies_invis and set topic to invisible by changing 'topic_invis' to 1
				$sql = " UPDATE " . TOPICS_TABLE . "
						$invis_query, topic_invis = $user_invis
						WHERE topic_id = $invis_topic";
				if ( !$db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, 'Error updating replies', '', __LINE__, __FILE__, $sql);
				}
				
				$result = $db->sql_fetchrow($result_topics_to_change); //Get next topic to change
				$invis_topic = $result['topic_id'];
			}
			
		}
		//InvisMod


# 
#-----[ FIND ]------------------------------------------ 
# 
user_active = $user_status,


# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
user_invis = $user_invis, 


 
#-----[ FIND ]------------------------------------------ 
# 
$user_status = $this_userdata['user_active'];


# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
//InvisMod
$user_invis = $this_userdata['user_invis']; 
//InvisMod

	  
# 
#-----[ FIND ]------------------------------------------ 
# 
$s_hidden_fields .= '<input type="hidden" name="user_status" value="' . $user_status . '" />';


# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
//InvisMod
$s_hidden_fields .= '<input type="hidden" name="user_invis" value="' . $user_invis . '" />'; 
//InvisMod


# 
#-----[ FIND ]------------------------------------------ 
# 
'ALLOW_AVATAR_YES' => ($user_allowavatar) ? 'checked="checked"' : '', 
'ALLOW_AVATAR_NO' => (!$user_allowavatar) ? 'checked="checked"' : '', 


# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
//InvisMod
'USER_INVIS_YES' => ($user_invis) ? 'checked="checked"' : '', 
'USER_INVIS_NO' => (!$user_invis) ? 'checked="checked"' : '', 
//InvisMod
		
					
# 
#-----[ FIND ]------------------------------------------ 
# 
'L_USER_ACTIVE' => $lang['User_status'],


# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
//InvisMod
'L_USER_INVIS' => $lang['User_invis'], 
//InvisMod
						
# 
#-----[ FIND ]------------------------------------------ 
# 
//
// Default user selection box
//

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
//InvisMod
	$sql = " SELECT COUNT(username) AS invis_user_count FROM " . USERS_TABLE . "
			WHERE user_invis = 1";
	if( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Error getting count of Invisible Status', '', __LINE__, __FILE__, $sql);
	}
	$result = $db->sql_fetchrow($result);
	$invis_count = $result['invis_user_count'];
	
	if( $invis_count > 0 )
	{
		$sql = " SELECT username FROM " . USERS_TABLE . "
				WHERE user_invis = 1 ORDER BY username ASC";
		if( !($invis_looper = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Error getting Names of Invisible Status', '', __LINE__, __FILE__, $sql);
		}

$show_invis = "<table cellspacing=\"1\" cellpadding=\"4\" border=\"0\" align=\"center\" class=\"forumline\"><tr><th class=\"thHead\" align=\"center\">Invisible Users</th></tr>";
		
		for( $xy_invis = 0; $xy_invis < $invis_count; $xy_invis++ )
		{
			$result = $db->sql_fetchrow($invis_looper);
			$the_user = $result['username'];
			$show_invis = $show_invis . "<tr><td class=\"row1\" align=\"center\"> $the_user </td></tr>";
		}
		$show_invis = $show_invis . "</table>";
	}
	else
	{
		$show_invis = '<table cellspacing="1" cellpadding="4" border="0" align="center" class="forumline">
		<tr>
			<th class="thHead" align="center">Invisible Users</th>
		</tr>
		<tr>
			<td class="row1" align="center"> No one on list. </td>
		</tr></table>';
	}
	//InvisMod
	

# 
#-----[ FIND ]------------------------------------------ 
# 
'S_USER_SELECT' => $select_list


# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
, 'SHOW_INVIS' => $show_invis


#
#-----[ OPEN ]------------------------------------------ 
#
language/lang_english/lang_admin.php


# 
#-----[ FIND ]------------------------------------------ 
# 
$lang['User_status'] = 'User is active';


# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
//InvisMod
$lang['User_invis'] = 'Posts and Topics are Invisible';
//InvisMod


#
#-----[ OPEN ]------------------------------------------ 
#
templates/subSilver/admin/user_edit_body.tpl


# 
#-----[ FIND ]------------------------------------------ 
# 
<tr> 
	  <td class="row1"><span class="gen">{L_USER_ACTIVE}</span></td>
	  <td class="row2"> 
		<input type="radio" name="user_status" value="1" {USER_ACTIVE_YES} />
		<span class="gen">{L_YES}</span>&nbsp;&nbsp; 
		<input type="radio" name="user_status" value="0" {USER_ACTIVE_NO} />
		<span class="gen">{L_NO}</span></td>
</tr>


# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
<!--InvisMod-->
<tr> 
	  <td class="row1"><span class="gen">{L_USER_INVIS}</span></td>
	  <td class="row2"> 
		<input type="radio" name="user_invis" value="1" {USER_INVIS_YES} />
		<span class="gen">{L_YES}</span>&nbsp;&nbsp; 
		<input type="radio" name="user_invis" value="0" {USER_INVIS_NO} />
		<span class="gen">{L_NO}</span></td>
</tr>
<!--InvisMod-->


#
#-----[ OPEN ]------------------------------------------ 
#
templates/subSilver/admin/user_select_body.tpl


#
#-----[ FIND ]------------------------------------------ 
#
<p>{L_USER_EXPLAIN}</p>


#
#-----[ AFTER, ADD ]------------------------------------------ 
#
<!-- InvisMod -->
<p> {SHOW_INVIS} </p>
<!-- InvisMod -->

#
#-----[ OPEN ]------------------------------------------ 
#
viewforum.php


# 
#-----[ FIND ]------------------------------------------ 
# 
//
// Grab all the basic data (all topics except announcements)
// for this forum
//
		
		
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
//InvisMod
if( $userdata['user_invis'] || $userdata['user_level'] == ADMIN)
{
	$show_only_to_offender = ""; //no restrictions
}
else
{
	$show_only_to_offender = "AND (t.topic_invis <> 1 OR (t.topic_invis = 1 AND (t.topic_replies - t.topic_replies_invis) > 0))";
}
//InvisMod


# 
#-----[ FIND ]------------------------------------------ 
# 
$limit_topics_time


# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
$show_only_to_offender


# 
#-----[ FIND ]------------------------------------------ 
# 
$replies = $topic_rowset[$i]['topic_replies'];


# 
#-----[ REPLACE WTIH ]------------------------------------------ 
# 
//InvisMod
		if( $userdata['user_level'] == ADMIN && $topic_rowset[$i]['topic_invis'] == 1 )
		{
			$topic_title = "<font color='#ff0000'>INVISIBLE TO MEMBERS <br> $topic_title</font>";
		}
		
		if( $topic_rowset[$i]['topic_invis'] )
		{
			if( $userdata['user_level'] == ADMIN || $topic_rowset[$i]['topic_poster'] == $userdata['user_id'] || $userdata['user_invis'] )
			{ 
				$replies = $topic_rowset[$i]['topic_replies']; 
			}
			else
			{ 	
				$replies = $topic_rowset[$i]['topic_replies_invis']; 
			}
			
		}
		else
		{
			$replies = $topic_rowset[$i]['topic_replies'];
		}
//InvisMod


# 
#-----[ FIND ]------------------------------------------ 
# 
$last_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['post_time'], $board_config['board_timezone']);

$last_post_author = ( $topic_rowset[$i]['id2'] == ANONYMOUS ) ? ( ($topic_rowset[$i]['post_username2'] != '' ) ? $topic_rowset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $topic_rowset[$i]['id2']) . '">' . $topic_rowset[$i]['user2'] . '</a>';
		
$last_post_url = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $topic_rowset[$i]['topic_last_post_id']) . '#' . $topic_rowset[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>';


# 
#-----[ REPLACE WTIH ]------------------------------------------
# 
//InvisMod
		if( $topic_rowset[$i]['topic_invis'] )
		{
			if( $userdata['user_level'] == ADMIN || $topic_rowset[$i]['topic_poster'] == $userdata['user_id'] || $userdata['user_invis'] || $topic_rowset[$i]['topic_replies'] == 0 && $topic_rowset[$i]['topic_invis_replies'] == 0)
			{
				$last_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['post_time'], $board_config['board_timezone']);

				$last_post_author = ( $topic_rowset[$i]['id2'] == ANONYMOUS ) ? ( ($topic_rowset[$i]['post_username2'] != '' ) ? $topic_rowset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $topic_rowset[$i]['id2']) . '">' . $topic_rowset[$i]['user2'] . '</a>';

				$last_post_url = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $topic_rowset[$i]['topic_last_post_id']) . '#' . $topic_rowset[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>';
			}
			else
			{
				//Change the most recent post URL and post Time
				$sql = " SELECT post_id, post_time, poster_id FROM " . POSTS_TABLE . "
						WHERE topic_id = $topic_id
						AND post_invis <> 1
						ORDER BY post_time DESC LIMIT 1"; //DESC means the latest post is first selection
				if( !($result = $db->sql_query($sql)) )
				{
					message_die(GENERAL_ERROR, 'Error getting recent posts', '', __LINE__, __FILE__, $sql);
				}
				
				$result = $db->sql_fetchrow($result);
				$invis_recent = $result['post_id'];
				$invis_recent_time = $result['post_time'];
				$invis_recent_poster = $result['poster_id'];
				
				//Get Username of recent post
				$sql = " SELECT username FROM " . USERS_TABLE . " WHERE user_id = $invis_recent_poster";
				if( !($result = $db->sql_query($sql)) )
				{
					message_die(GENERAL_ERROR, 'Error getting UserName', '', __LINE__, __FILE__, $sql);
				}
				$result = $db->sql_fetchrow($result);
				$invis_poster = $result['username'];
				
				$last_post_time = create_date($board_config['default_dateformat'], $invis_recent_time, $board_config['board_timezone']);
				
				$last_post_author = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $invis_recent_poster) . '">' . $invis_poster . '</a>';
								
				$last_post_url = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $invis_recent) . '#' . $invis_recent . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>';

}
		}
		else
		{
			$last_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['post_time'], $board_config['board_timezone']);

			$last_post_author = ( $topic_rowset[$i]['id2'] == ANONYMOUS ) ? ( ($topic_rowset[$i]['post_username2'] != '' ) ? $topic_rowset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $topic_rowset[$i]['id2']) . '">' . $topic_rowset[$i]['user2'] . '</a>';

			$last_post_url = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $topic_rowset[$i]['topic_last_post_id']) . '#' . $topic_rowset[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>';
		}
		//InvisMod

#
#-----[ OPEN ]------------------------------------------ 
#
viewtopic.php


# 
#-----[ FIND ]------------------------------------------ 
# 
//
// Go ahead and pull all data for this topic
//


# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
//InvisMod
if( $userdata['user_invis'] || $userdata['user_level'] == ADMIN )
{
	$show_only_to_offender = ""; //no restrictions
}
else
{
	$show_only_to_offender = "AND p.post_invis <> 1";
}
//InvisMod


# 
#-----[ FIND ]------------------------------------------ 
# 
AND pt.post_id = p.post_id
AND u.user_id = p.poster_id


# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
$show_only_to_offender


# 
#-----[ FIND ]------------------------------------------ 
# 
$message = $postrow[$i]['post_text'];

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
//InvisMod
if( $userdata['user_level'] == ADMIN && $postrow[$i]['post_invis'] == 1 )
{
	$post_subject = "<font color='#ff0000'>$post_subject</font>";
	$message = "<font color='#ff0000'>** INVISIBLE TO MEMBERS **<br><br> $message <br><br>** INVISIBLE TO MEMBERS **</font>";
}
//InvisMod


#
#-----[ OPEN ]------------------------------------------ 
#
includes/functions_post.php

# 
#-----[ FIND ]------------------------------------------ 
# 
$sql  = ($mode != "editpost") ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster,

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
topic_invis,

# 
#-----[ FIND ]------------------------------------------ 
# 
VALUES ('$post_subject', " . $userdata['user_id'] . ",

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
 " . $userdata['user_invis'] . ",
 
 
# 
#-----[ FIND ]------------------------------------------ 
# 
$sql = ($mode != "editpost") ? "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id,


# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
 post_invis, 
 
# 
#-----[ FIND ]------------------------------------------ 
# 
VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ",

# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
# 
" . $userdata['user_invis'] . ",

#
#-----[ OPEN ]------------------------------------------ 
#
index.php

# 
#-----[ FIND ]------------------------------------------ 
# 
$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);

$last_post = $last_post_time . '<br />';

$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';
								
$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
	
# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
//InvisMod
//Find last post that is not invisible
$sql = " SELECT post_id, poster_id, post_time FROM " . POSTS_TABLE . "
		WHERE forum_id = $forum_id
		AND post_invis <> 1
		ORDER BY post_time DESC LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Error getting last poster', '', __LINE__, __FILE__, $sql);
}
$result = $db->sql_fetchrow($result);
$searcher = $result['poster_id'];
								
$sql = " SELECT username FROM " . USERS_TABLE . "
		WHERE user_id = $searcher";
if ( !($list = $db->sql_query($sql)) )
{
}
$thename = $db->sql_fetchrow($list);
								
$last_post_time = create_date($board_config['default_dateformat'], $result['post_time'], $board_config['board_timezone']);

$last_post = $last_post_time . '<br />';

$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $result['poster_id']) . '">' . $thename['username'] . '</a> ';
								
$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $result['post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
//InvisMod					

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 


Last edited by DarKnight on Wed May 05, 2004 7:23 pm, edited 11 times in total.
quentin
Registered User
Posts: 197
Joined: Tue May 20, 2003 7:30 am
Location: Geneva, Switzerland
Contact:

Post by quentin »

is it the same type of anti spam as this other mod tarb-abuse tool ?
If yes, well this is awesome since indifference is really the best way to get rid of spammers.

Quentin
The largest message boards on the web !
Web Design Library (coming soon)
Friends sites: Heroes of might and magic - Biometric security
DarKnight
Registered User
Posts: 26
Joined: Mon Aug 18, 2003 7:56 am

Post by DarKnight »

i never installed the tarb abuse mod so i dont know if this is the same. The idea may be similar.
User avatar
Haywood Jahelpme
Registered User
Posts: 475
Joined: Wed Oct 23, 2002 9:16 am
Location: San Diego
Contact:

Post by Haywood Jahelpme »

Thanks DarKnight! Pretty good idea you have here... Plan on getting lots of feature requests as this seems to be a much needed feature of phpBB....

My feature request: make it work based on IP address too...

thanks for your hard work! I will test it out on my 2.0.4 board in the next few days....
DarKnight
Registered User
Posts: 26
Joined: Mon Aug 18, 2003 7:56 am

Post by DarKnight »

Keeping track of the IP would be a huge task but can be done.

Was thinking about using cookies first but it does have some major disadvantages.
User avatar
Haywood Jahelpme
Registered User
Posts: 475
Joined: Wed Oct 23, 2002 9:16 am
Location: San Diego
Contact:

Post by Haywood Jahelpme »

I figured out a way to get the fool to register for an account... bwahahahahaha

/me goes to try this mod out....
User avatar
Haywood Jahelpme
Registered User
Posts: 475
Joined: Wed Oct 23, 2002 9:16 am
Location: San Diego
Contact:

Post by Haywood Jahelpme »

In the middle of the mod here... Having a bit of trouble locating these two sections in lang_admin:

Code: Select all

#-----[ FIND ]------------------------------------------ 
# 
// 
// Default user selection box 
// 

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
//InvisMod 
   $sql = " SELECT COUNT(username) AS invis_user_count FROM " . USERS_TABLE . " 
         WHERE user_invis = 1"; 
   if( !($result = $db->sql_query($sql)) ) 
   { 
      message_die(GENERAL_ERROR, 'Error getting count of Invisible Status', '', __LINE__, __FILE__, $sql); 
   } 
   $result = $db->sql_fetchrow($result); 
   $invis_count = $result['invis_user_count']; 
    
   if( $invis_count > 0 ) 
   { 
      $sql = " SELECT username FROM " . USERS_TABLE . " 
            WHERE user_invis = 1 ORDER BY username ASC"; 
      if( !($invis_looper = $db->sql_query($sql)) ) 
      { 
         message_die(GENERAL_ERROR, 'Error getting Names of Invisible Status', '', __LINE__, __FILE__, $sql); 
      } 

$show_invis = "<table cellspacing=\"1\" cellpadding=\"4\" border=\"0\" align=\"center\" class=\"forumline\"><tr><th class=\"thHead\" align=\"center\">Invisible Users</th></tr>"; 
       
      for( $xy_invis = 0; $xy_invis < $invis_count; $xy_invis++ ) 
      { 
         $result = $db->sql_fetchrow($invis_looper); 
         $the_user = $result['username']; 
         $show_invis = $show_invis . "<tr><td class=\"row1\" align=\"center\"> $the_user </td></tr>"; 
      } 
      $show_invis = $show_invis . "</table>"; 
   } 
   else 
   { 
      $show_invis = '<table cellspacing="1" cellpadding="4" border="0" align="center" class="forumline"> 
      <tr> 
         <th class="thHead" align="center">Invisible Users</th> 
      </tr> 
      <tr> 
         <td class="row1" align="center"> No one on list. </td> 
      </tr></table>'; 
   } 
   //InvisMod 
    

# 
#-----[ FIND ]------------------------------------------ 
# 
'S_USER_SELECT' => $select_list 


# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
, 'SHOW_INVIS' => $show_invis 

DarKnight
Registered User
Posts: 26
Joined: Mon Aug 18, 2003 7:56 am

Post by DarKnight »

woops

that section should belong in the admin_users section.. sorry

correction made to the source.
User avatar
Rookie7
Registered User
Posts: 189
Joined: Mon Mar 10, 2003 3:32 pm
Contact:

Post by Rookie7 »

What about deleting them instead of hiding them? Can that be done?
User avatar
malitic
Registered User
Posts: 168
Joined: Fri Jul 18, 2003 4:05 pm

Post by malitic »

Rookie7 wrote: What about deleting them instead of hiding them? Can that be done?



I think that would ruin the point of it...Its supposed to make the spammer think he is actually spamming.
DarKnight
Registered User
Posts: 26
Joined: Mon Aug 18, 2003 7:56 am

Post by DarKnight »

deleting the user's posts would be a separate mod. For now I'm just going to add functionality and fix bugs.
davidh44
Registered User
Posts: 386
Joined: Sat Mar 09, 2002 5:56 am

Post by davidh44 »

Nice work!
User avatar
beggers
Registered User
Posts: 1257
Joined: Fri Nov 23, 2001 8:19 pm
Location: Las Vegas
Contact:

Post by beggers »

I'm curious about one thing. Since the spammer is still registered, could they still use chats, shoutboxes and other features available to members?
DarKnight
Registered User
Posts: 26
Joined: Mon Aug 18, 2003 7:56 am

Post by DarKnight »

i don't think phpbb has a built in chat. But in reference to the user being able to use the features of your site: YES.
User avatar
Haywood Jahelpme
Registered User
Posts: 475
Joined: Wed Oct 23, 2002 9:16 am
Location: San Diego
Contact:

Post by Haywood Jahelpme »

DarKnight wrote: woops
that section should belong in the admin_users section.. sorry
correction made to the source.


Uhm.... That is where the directions said to look in the first place... It's still not there. :? :wink:

Also, there are a couple places where your

Code: Select all

 & nbsp;& nbsp;
got converted here to

Code: Select all

&&
, so you may want to just link to a zip to save yourself the headache of supporting those issues...

Thanks!
Locked

Return to “[2.0.x] MODs in Development”