1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-06 14:35:56 +02:00

Made viewip in modcp.php usefull and introduced an undocumented feature :D

git-svn-id: file:///svn/phpbb/trunk@2239 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Bart van Bragt 2002-03-01 17:05:21 +00:00
parent cbf63d31c4
commit 375e90d8c4
2 changed files with 26 additions and 13 deletions

View File

@ -883,41 +883,53 @@ switch($mode)
//
// Get other IP's this user has posted under
//
$sql = "SELECT DISTINCT poster_ip
$sql = "SELECT poster_ip, count(*) as postings
FROM " . POSTS_TABLE . "
WHERE poster_id = $poster_id
AND poster_ip <> '" . $post_row['poster_ip'] . "'
ORDER BY poster_ip DESC";
GROUP BY (poster_ip)
ORDER BY postings DESC";
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);
$j = 0;
for($i = 0; $i < count($poster_ips); $i++)
{
if ( $poster_ips[$i]['poster_ip'] == $post_row['poster_ip'] )
{
$template->assign_vars(array(
"POSTINGS" => $poster_ips[$i]['postings'] . " " .$lang['Posts'])
);
continue;
}
$ip = decode_ip($poster_ips[$i]['poster_ip']);
$ip = ( $rdns_ip_num == $ip ) ? gethostbyaddr($ip) : $ip;
$ip = ( $rdns_ip_num == $poster_ips[$i]['poster_ip'] || $rdns_ip_num == 'all') ? gethostbyaddr($ip) : $ip;
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$j++; // Can't use $i because of the 'continue'
$row_color = ( !($j % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($j % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars("iprow", array(
"ROW_COLOR" => "#" . $row_color,
"ROW_CLASS" => $row_class,
"IP" => $ip,
"IP" => $ip,
"POSTINGS" => $poster_ips[$i]['postings'] . " " .$lang['Posts'],
"U_LOOKUP_IP" => append_sid("modcp.$phpEx?mode=ip&amp;" . POST_POST_URL . "=$post_id&amp;" . POST_TOPIC_URL . "=$topic_id&amp;rdns=" . $ip))
"U_LOOKUP_IP" => append_sid("modcp.$phpEx?mode=ip&amp;" . POST_POST_URL . "=$post_id&amp;" . POST_TOPIC_URL . "=$topic_id&amp;rdns=" . $poster_ips[$i]['poster_ip']))
);
}
//
// Get other users who've posted under this IP
//
$sql = "SELECT DISTINCT u.username, u.user_id
$sql = "SELECT u.user_id, u.username, count(*) as postings
FROM " . USERS_TABLE ." u, " . POSTS_TABLE . " p
WHERE p.poster_id = u.user_id
AND p.poster_ip = '" . $post_row['poster_ip'] . "'";
AND p.poster_ip = '" . $post_row['poster_ip'] . "'
GROUP BY u.user_id, u.username
ORDER BY postings DESC";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not get posters information based on IP", "Error", __LINE__, __FILE__, $sql);
@ -936,6 +948,7 @@ switch($mode)
"ROW_COLOR" => "#" . $row_color,
"ROW_CLASS" => $row_class,
"USERNAME" => $username,
"POSTINGS" => $poster_ids[$i]['postings'] . " " .$lang['Posts'],
"L_SEARCH_POSTS" => sprintf($lang['Search_user_posts'], $username),
"U_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=$id"),

View File

@ -16,7 +16,7 @@
<td class="row1">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>&nbsp;<span class="gen">{IP}</span></td>
<td>&nbsp;<span class="gen">{IP} ({POSTINGS})</span></td>
<td align="right"><span class="gen">[ <a href="{U_LOOKUP_IP}">{L_LOOKUP_IP}</a>
]&nbsp;</span></td>
</tr>
@ -31,7 +31,7 @@
<td class="{userrow.ROW_CLASS}">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>&nbsp;<span class="gen"><a href="{userrow.U_PROFILE}">{userrow.USERNAME}</a></span></td>
<td>&nbsp;<span class="gen"><a href="{userrow.U_PROFILE}">{userrow.USERNAME}</a> ({userrow.POSTINGS})</span></td>
<td align="right"><a href="{userrow.U_SEARCHPOSTS}" title="{userrow.L_SEARCH_POSTS}"><img src="{SEARCH_IMG}" border="0" alt="{L_SEARCH}" /></a>
&nbsp;</td>
</tr>
@ -46,7 +46,7 @@
<tr>
<td class="{iprow.ROW_CLASS}"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>&nbsp;<span class="gen">{iprow.IP}</span></td>
<td>&nbsp;<span class="gen">{iprow.IP} ({iprow.POSTINGS})</span></td>
<td align="right"><span class="gen">[ <a href="{iprow.U_LOOKUP_IP}">{L_LOOKUP_IP}</a>
]&nbsp;</span></td>
</tr>