aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorBart van Bragt <bartvb@users.sourceforge.net>2002-03-01 17:05:21 +0000
committerBart van Bragt <bartvb@users.sourceforge.net>2002-03-01 17:05:21 +0000
commit375e90d8c40f467bbc313c591d7ff170a264ffaf (patch)
treea97a994c537b1278451bb745a6d8a3fefab2c93d /phpBB
parentcbf63d31c4ca876ff9cc74851d3bfc9e0707c6bb (diff)
downloadforums-375e90d8c40f467bbc313c591d7ff170a264ffaf.tar
forums-375e90d8c40f467bbc313c591d7ff170a264ffaf.tar.gz
forums-375e90d8c40f467bbc313c591d7ff170a264ffaf.tar.bz2
forums-375e90d8c40f467bbc313c591d7ff170a264ffaf.tar.xz
forums-375e90d8c40f467bbc313c591d7ff170a264ffaf.zip
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
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/modcp.php33
-rw-r--r--phpBB/templates/subSilver/modcp_viewip.tpl6
2 files changed, 26 insertions, 13 deletions
diff --git a/phpBB/modcp.php b/phpBB/modcp.php
index 333b147191..a0e8d73f8f 100644
--- a/phpBB/modcp.php
+++ b/phpBB/modcp.php
@@ -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"),
diff --git a/phpBB/templates/subSilver/modcp_viewip.tpl b/phpBB/templates/subSilver/modcp_viewip.tpl
index 5fbead798a..19749d9494 100644
--- a/phpBB/templates/subSilver/modcp_viewip.tpl
+++ b/phpBB/templates/subSilver/modcp_viewip.tpl
@@ -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>