View IP code in

git-svn-id: file:///svn/phpbb/trunk@1008 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
James Atkinson 2001-09-07 22:56:50 +00:00
parent 60e3f50b61
commit d51c14ea0a
4 changed files with 131 additions and 68 deletions

View file

@ -629,8 +629,10 @@ $lang['Topic_split'] = "The selected topic has been split successfully";
$lang['Too_many_error'] = "You have selected too many posts. You can only select one post to split a topic after!"; $lang['Too_many_error'] = "You have selected too many posts. You can only select one post to split a topic after!";
$lang['New_forum'] = "New forum"; $lang['New_forum'] = "New forum";
$lang['None_selected'] = "You have no selected any topics to preform this operation on. Please go back and select at least one."; $lang['None_selected'] = "You have no selected any topics to preform this operation on. Please go back and select at least one.";
$lang['IP_on_this_post'] = "IP for this post";
$lang['Other_IPS_this_user'] = "Other IP's this user has posted from";
$lang['Other_users_this_IP'] = "Other users who have used this IP";
$lang['IP_info'] = "IP Information";
// //
// Timezones ... for display on each page // Timezones ... for display on each page
// //

View file

@ -115,6 +115,7 @@ include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
"body" => "modcp_body.tpl", "body" => "modcp_body.tpl",
"confirm" => "confirm_body.tpl", "confirm" => "confirm_body.tpl",
"viewip" => "modcp_viewip.tpl",
"split_body" => "split_body.tpl") "split_body" => "split_body.tpl")
); );
@ -756,43 +757,65 @@ switch($mode)
} }
// Look up relevent data for this post // Look up relevent data for this post
$sql = "SELECT poster_ip, poster_id, post_username FROM ".POSTS_TABLE." WHERE post_id = $post_id"; $sql = "SELECT poster_ip, poster_id FROM ".POSTS_TABLE." WHERE post_id = $post_id";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
message_die(GENERAL_ERROR, "Could not get poster IP information", "Error", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Could not get poster IP information", "Error", __LINE__, __FILE__, $sql);
} }
$post_row = $db->sql_fetchrow($result); $post_row = $db->sql_fetchrow($result);
$ip_this_post = decode_ip($post_row['poster_ip']);
$poster_id = $post_row['poster_id'];
$template->assign_vars(array("L_IPINFO" => $lang['IP_info'],
"L_IPTHISPOST" => $lang['IP_on_this_post'],
"L_OTHERIPS" => $lang['Other_IPS_this_user'],
"L_OTHERUSERS" => $lang['Other_users_this_IP'],
"L_SEARCHPOSTS" => $lang['Search_user_posts'],
"IP" => $ip_this_post));
//
// Get other IP's this user has posted under
//
$sql = "SELECT DISTINCT poster_ip FROM " . POSTS_TABLE . " WHERE poster_id = $poster_id AND poster_ip <> '".$post_row['poster_ip']."'";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not get IP information for this user", "Error", __LINE__, __FILE__, $sql);
}
$poster_ips = $db->sql_fetchrowset($result);
for($i = 0; $i < count($poster_ips); $i++)
{
$ip = decode_ip($poster_ips[$i]['poster_ip']);
$template->assign_block_vars("iprow", array("IP" => $ip));
}
//
// Get other users who've posted under this IP // Get other users who've posted under this IP
$sql = "SELECT u.username, u.user_id FROM " . USERS_TABLE ." u, " . POSTS_TABLE . " p WHERE p.poster_id = u.user_id AND p.poster_ip = '".$post_row['poster_ip']."'"; //
$sql = "SELECT DISTINCT u.username, u.user_id FROM " . USERS_TABLE ." u, " . POSTS_TABLE . " p WHERE p.poster_id = u.user_id AND p.poster_ip = '".$post_row['poster_ip']."'";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
message_die(GENERAL_ERROR, "Could not get posters information based on IP", "Error", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Could not get posters information based on IP", "Error", __LINE__, __FILE__, $sql);
} }
$poster_ids = $db->sql_fetchrowset($result); $poster_ids = $db->sql_fetchrowset($result);
sort($poster_ids); for($i = 0; $i < count($poster_ids); $i++)
$posts = 0;
while(list($null, $userdata) = each($poster_ids))
{ {
$username = $userdata['username']; $id = $poster_ids[$i]['user_id'];
$user_id = $userdata['user_id']; $username = $poster_ids[$i]['username'];
if($username != $last_username && !empty($last_username)) if($id == ANONYMOUS)
{ {
$other_users[] = array("username" => "$last_username", "user_id" => "$last_user_id", "posts" => "$posts"); $username = $lang['Guest'];
$posts = 1;
} }
else
{ $template->assign_block_vars("userrow", array("U_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$id"),
$posts += 1; "USERNAME" => $username,
} "U_SEARCHPOSTS" => append_sid("search.$phpEx?a=" . urlencode($username) . "&amp;f=all&amp;b=0&amp;d=DESC&amp;c=100&amp;dosearch=1")));
$last_username = $username;
$last_user_ip = $user_id;
} }
$template->pparse("viewip");
break; break;
default: default:

View file

@ -0,0 +1,38 @@
<table width="98%" cellspacing="0" cellpadding="4" border="0" align="center">
<tr>
<td align="left"><span class="gensmall"><a href="{U_INDEX}">{SITENAME}&nbsp;{L_INDEX}</a></span></td>
</tr>
</table>
<table width="98%" cellpadding="1" cellspacing="0" border="0" align="center">
<tr>
<td class="tablebg"><table width="100%" cellpadding="3" cellspacing="1" border="0">
<tr>
<th class="cat" colspan="2"><span class="cattitle"><b>{L_IPINFO}</b></span></th>
</tr>
<tr>
<td class="row1" width="15%"><span class="gen">{L_IPTHISPOST}</span></td>
<td class="row2"><span class="gen">{IP}</td>
</tr>
<tr>
<th class="cat" colspan="2" align="left"><span class="cattitle"><b>{L_OTHERUSERS}</b></span></th>
</tr>
<!-- BEGIN userrow -->
<tr>
<td class="row1" colspan="2"><span class="gen"><a href="{userrow.U_PROFILE}">{userrow.USERNAME}</a> [<a href="{userrow.U_SEARCHPOSTS}">{L_SEARCHPOSTS}</a>]</td>
</tr>
<!-- END userrow -->
<tr>
<th class="cat" colspan="2" align="left"><span class="cattitle"><b>{L_OTHERIPS}</b></span></th>
</tr>
<!-- BEGIN iprow -->
<tr>
<td class="row1" colspan="2"><span class="gen">{iprow.IP}</td>
</tr>
<!-- END iprow -->
</table></td>
</tr>
</table>
<br clear="all" />

View file

@ -720,7 +720,7 @@ for($i = 0; $i < $total_posts; $i++)
if( $is_auth['auth_mod'] ) if( $is_auth['auth_mod'] )
{ {
$ip_img = "<a href=\"" . append_sid("modcp.$phpEx?mode=viewip&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id']) . "\"><img src=\"" . $images['icon_ip'] . "\" alt=\"" . $lang['View_IP'] . "\" border=\"0\" /></a>"; $ip_img = "<a href=\"" . append_sid("modcp.$phpEx?mode=ip&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&" . POST_TOPIC_URL . "=" . $topic_id) . "\"><img src=\"" . $images['icon_ip'] . "\" alt=\"" . $lang['View_IP'] . "\" border=\"0\" /></a>";
$delpost_img = "<a href=\"" . append_sid("topicadmin.$phpEx?mode=delpost&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id']) . "\"><img src=\"" . $images['icon_delpost'] . "\" alt=\"" . $lang['Delete_post'] . "\" border=\"0\" /></a>"; $delpost_img = "<a href=\"" . append_sid("topicadmin.$phpEx?mode=delpost&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id']) . "\"><img src=\"" . $images['icon_delpost'] . "\" alt=\"" . $lang['Delete_post'] . "\" border=\"0\" /></a>";
} }