Page 1 of 1

where it stores IP adresses of the post?

Posted: Sun Jan 23, 2005 11:52 pm
by gr33n
where it stores IP adresses of the post?

Posted: Mon Jan 24, 2005 12:07 am
by zeroK
In the phpbb_posts table (poster_ip field).

Posted: Mon Jan 24, 2005 12:23 am
by gr33n
jep.. their encrypted there... i was wondering if they are in plain text there.

ok.. but how can i turn my bb 2.0.10 to show IPs to only administrators.. not to moderators?

Posted: Mon Jan 24, 2005 9:06 am
by zeroK
gr33n wrote: jep.. their encrypted there... i was wondering if they are in plain text there.
You could simply use the encode_ip and decode_ip functions in the include/functions.php :-)
ok.. but how can i turn my bb 2.0.10 to show IPs to only administrators.. not to moderators?

I think you'll have to change this section in the viewtopic.php to achieve this (line 1006-1032):

Code: Select all

	if ( $is_auth['auth_mod'] )
	{
		$temp_url = "modcp.$phpEx?mode=ip&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&" . POST_TOPIC_URL . "=" . $topic_id . "&sid=" . $userdata['session_id'];
		$ip_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_ip'] . '" alt="' . $lang['View_IP'] . '" title="' . $lang['View_IP'] . '" border="0" /></a>';
		$ip = '<a href="' . $temp_url . '">' . $lang['View_IP'] . '</a>';

		$temp_url = "posting.$phpEx?mode=delete&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&sid=" . $userdata['session_id'];
		$delpost_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_delpost'] . '" alt="' . $lang['Delete_post'] . '" title="' . $lang['Delete_post'] . '" border="0" /></a>';
		$delpost = '<a href="' . $temp_url . '">' . $lang['Delete_post'] . '</a>';
	}
	else
	{
		$ip_img = '';
		$ip = '';

		if ( $userdata['user_id'] == $poster_id && $is_auth['auth_delete'] && $forum_topic_data['topic_last_post_id'] == $postrow[$i]['post_id'] )
		{
			$temp_url = "posting.$phpEx?mode=delete&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&sid=" . $userdata['session_id'];
			$delpost_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_delpost'] . '" alt="' . $lang['Delete_post'] . '" title="' . $lang['Delete_post'] . '" border="0" /></a>';
			$delpost = '<a href="' . $temp_url . '">' . $lang['Delete_post'] . '</a>';
		}
		else
		{
			$delpost_img = '';
			$delpost = '';
		}
	}
I think this should hide the link for moderators:

Code: Select all

	if ($userdata['user_level'] == ADMIN)
	{
		$temp_url = "modcp.$phpEx?mode=ip&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&" . POST_TOPIC_URL . "=" . $topic_id . "&sid=" . $userdata['session_id'];
		$ip_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_ip'] . '" alt="' . $lang['View_IP'] . '" title="' . $lang['View_IP'] . '" border="0" /></a>';
		$ip = '<a href="' . $temp_url . '">' . $lang['View_IP'] . '</a>';
	}
	else 
	{
		$ip_img = '';
		$ip = '';
	}
	if ( $is_auth['auth_mod'] )
	{
		$temp_url = "posting.$phpEx?mode=delete&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&sid=" . $userdata['session_id'];
		$delpost_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_delpost'] . '" alt="' . $lang['Delete_post'] . '" title="' . $lang['Delete_post'] . '" border="0" /></a>';
		$delpost = '<a href="' . $temp_url . '">' . $lang['Delete_post'] . '</a>';
	}
	else
	{

		if ( $userdata['user_id'] == $poster_id && $is_auth['auth_delete'] && $forum_topic_data['topic_last_post_id'] == $postrow[$i]['post_id'] )
		{
			$temp_url = "posting.$phpEx?mode=delete&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&sid=" . $userdata['session_id'];
			$delpost_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_delpost'] . '" alt="' . $lang['Delete_post'] . '" title="' . $lang['Delete_post'] . '" border="0" /></a>';
			$delpost = '<a href="' . $temp_url . '">' . $lang['Delete_post'] . '</a>';
		}
		else
		{
			$delpost_img = '';
			$delpost = '';
		}
	}
Then you'll have to restrict the access to the modcp a little bit. Open the modcp.php and search for following section:

Code: Select all

//
// Start auth check
//
$is_auth = auth(AUTH_ALL, $forum_id, $userdata);

if ( !$is_auth['auth_mod'] )
{
	message_die(GENERAL_MESSAGE, $lang['Not_Moderator'], $lang['Not_Authorised']);
}
//
// End Auth Check
//
We only want admins to be able to use the ip-mode. So replacing this section with something like this should do the job:

Code: Select all

//
// Start auth check
//
$is_auth = auth(AUTH_ALL, $forum_id, $userdata);

if ( !$is_auth['auth_mod'] || ($mode=='ip' && $userdata['user_level'] != ADMIN) )
{
	message_die(GENERAL_MESSAGE, $lang['Not_Moderator'], $lang['Not_Authorised']);
}
//
// End Auth Check
//
Please make backups of your files before doing this. I have not tried these changes!

Posted: Sat Mar 05, 2005 6:52 pm
by gr33n
thank you!