diff options
author | Bart van Bragt <bartvb@users.sourceforge.net> | 2002-03-01 17:05:21 +0000 |
---|---|---|
committer | Bart van Bragt <bartvb@users.sourceforge.net> | 2002-03-01 17:05:21 +0000 |
commit | 375e90d8c40f467bbc313c591d7ff170a264ffaf (patch) | |
tree | a97a994c537b1278451bb745a6d8a3fefab2c93d /phpBB/modcp.php | |
parent | cbf63d31c4ca876ff9cc74851d3bfc9e0707c6bb (diff) | |
download | forums-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/modcp.php')
-rw-r--r-- | phpBB/modcp.php | 33 |
1 files changed, 23 insertions, 10 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&" . POST_POST_URL . "=$post_id&" . POST_TOPIC_URL . "=$topic_id&rdns=" . $ip)) + "U_LOOKUP_IP" => append_sid("modcp.$phpEx?mode=ip&" . POST_POST_URL . "=$post_id&" . POST_TOPIC_URL . "=$topic_id&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&" . POST_USERS_URL . "=$id"), |