Add IP/rDNS/whois info to viewonline ... doing away with need to visit ACP

git-svn-id: file:///svn/phpbb/trunk@4742 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2004-01-10 18:41:53 +00:00
parent af070017d3
commit 7abe67c821
5 changed files with 62 additions and 13 deletions

View file

@ -358,6 +358,7 @@ $lang = array(
'LOGIN' => 'Login', 'LOGIN' => 'Login',
'LOGIN_INFO' => 'In order to login you must be registered. Registering takes only a few seconds but gives you increased capabilies. The board administrator may also grant additional permissions to registered users. Before you login please ensure you are familiar with our terms of use and related policies. Please ensure you read any forum rules as you navigate around the board.',
'TERMS_USE' => 'Terms of Use', 'TERMS_USE' => 'Terms of Use',
'PRIVACY' => 'Privacy Policy', 'PRIVACY' => 'Privacy Policy',
'FORGOT_PASS' => 'I forgot my password', 'FORGOT_PASS' => 'I forgot my password',
@ -1222,18 +1223,14 @@ $lang += array(
'VIEW_ONLINE_TIMES' => 'This data is based on users active over the past %d minutes', // 2 minutes, etc. 'VIEW_ONLINE_TIMES' => 'This data is based on users active over the past %d minutes', // 2 minutes, etc.
'FORUM_LOCATION' => 'Forum Location', 'FORUM_LOCATION' => 'Forum Location',
'LAST_UPDATED' => 'Last Updated', 'LAST_UPDATED' => 'Last Updated',
'IP' => 'IP', // IP: x.x.x.x or somedomain.com
'WHOIS' => 'Whois',
'READING_FORUM' => 'Viewing topics in %s', 'READING_FORUM' => 'Viewing topics in %s',
'READING_TOPIC' => 'Reading topic in %s', 'READING_TOPIC' => 'Reading topic in %s',
'POSTING_MESSAGE' => 'Posting message in %s', 'POSTING_MESSAGE' => 'Posting message in %s',
'REPLYING_MESSAGE' => 'Replying to message in %s', 'REPLYING_MESSAGE' => 'Replying to message in %s',
'READING_GLOBAL_ANNOUNCE' => 'Reading global announcement', 'READING_GLOBAL_ANNOUNCE' => 'Reading global announcement',
'REPLYING_GLOBAL_ANNOUNCE' => 'Replying to global announcement', 'REPLYING_GLOBAL_ANNOUNCE' => 'Replying to global announcement',
'SEARCHING_FORUMS' => 'Searching forums',
'VIEWING_ONLINE' => 'Viewing who is online',
'VIEWING_MEMBERS' => 'Viewing member details',
'VIEWING_MESSAGES' => 'Viewing Private Messages',
'VIEWING_FAQ' => 'Viewing FAQ',
'SEARCHING_FORUMS' => 'Searching forums', 'SEARCHING_FORUMS' => 'Searching forums',
'VIEWING_ONLINE' => 'Viewing who is online', 'VIEWING_ONLINE' => 'Viewing who is online',
'VIEWING_MEMBERS' => 'Viewing member details', 'VIEWING_MEMBERS' => 'Viewing member details',

View file

@ -26,9 +26,9 @@ if ({S_NEW_PM})
} }
<!-- ENDIF --> <!-- ENDIF -->
function im_popup(url, width, height) function popup(url, width, height)
{ {
window.open(url, '_contact', 'HEIGHT=' + height + ',resizable=yes,scrollbars=yes, WIDTH=' + width); window.open(url, '_popup', 'HEIGHT=' + height + ',resizable=yes,scrollbars=yes, WIDTH=' + width);
return false; return false;
} }

View file

@ -17,7 +17,7 @@
<!-- ELSE --> <!-- ELSE -->
<tr class="row2"> <tr class="row2">
<!-- ENDIF --> <!-- ENDIF -->
<td class="row1" width="35%">&nbsp;<span class="gen"><!-- IF reg_user_row.U_USER_PROFILE --><a href="{reg_user_row.U_USER_PROFILE}" title="{reg_user_row.USER_IP}"><!-- ENDIF -->{reg_user_row.USERNAME}<!-- IF reg_user_row.U_USER_PROFILE --></a><!-- ENDIF -->&nbsp;</span></td> <td class="row1" width="35%"><p class="gen"><!-- IF reg_user_row.U_USER_PROFILE --><a href="{reg_user_row.U_USER_PROFILE}"><!-- ENDIF -->{reg_user_row.USERNAME}<!-- IF reg_user_row.U_USER_PROFILE --></a><!-- ENDIF -->&nbsp;</p><!-- IF reg_user_row.USER_IP --><p class="gensmall">{L_IP}: <a href="{reg_user_row.U_USER_IP}">{reg_user_row.USER_IP}</a> &#187; <a href="{reg_user_row.U_WHOIS}" onclick="popup('{reg_user_row.U_WHOIS}', 750, 500);return false">{L_WHOIS}</a></p><!-- ENDIF --></td>
<td class="row1" width="25%" align="center" nowrap="nowrap"><span class="gen">&nbsp;{reg_user_row.LASTUPDATE}&nbsp;</span></td> <td class="row1" width="25%" align="center" nowrap="nowrap"><span class="gen">&nbsp;{reg_user_row.LASTUPDATE}&nbsp;</span></td>
<td class="row1" width="40%">&nbsp;<a class="gen" href="{reg_user_row.U_FORUM_LOCATION}">{reg_user_row.FORUM_LOCATION}</a>&nbsp;</td> <td class="row1" width="40%">&nbsp;<a class="gen" href="{reg_user_row.U_FORUM_LOCATION}">{reg_user_row.FORUM_LOCATION}</a>&nbsp;</td>
</tr> </tr>

View file

@ -0,0 +1,15 @@
<!-- INCLUDE simple_header.html -->
<!-- $Id$ -->
<table class="tablebg" width="100%" cellspacing="1">
<tr>
<th>{L_WHOIS}</th>
</tr>
<tr>
<td class="row1"><pre>{WHOIS}</pre></td>
</tr>
</table>
<!-- INCLUDE simple_footer.html -->

View file

@ -22,6 +22,8 @@ $auth->acl($user->data);
$user->setup(); $user->setup();
// Get and set some variables // Get and set some variables
$mode = request_var('mode', '');
$user_id = request_var('u', 0);
$start = request_var('start', 0); $start = request_var('start', 0);
$sort_key = request_var('sk', 'b'); $sort_key = request_var('sk', 'b');
$sort_dir = request_var('sd', 'd'); $sort_dir = request_var('sd', 'd');
@ -32,6 +34,39 @@ $sort_key_sql = array('a' => 'username', 'b' => 'session_time', 'c' => 'session_
// Sorting and order // Sorting and order
$order_by = $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC'); $order_by = $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC');
// Whois requested
if ($mode == 'whois')
{
include($phpbb_root_path.'includes/functions_admin.'.$phpEx);
$sql = 'SELECT u.user_id, u.username, u.user_type, s.session_ip
FROM ' . USERS_TABLE . ' u, ' . SESSIONS_TABLE . " s
WHERE u.user_id = $user_id
AND s.session_user_id = u.user_id";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
$whois = ipwhois($row['session_ip']);
$whois = preg_replace('#(\s+?)([\w\-\._\+]+?@[\w\-\.]+?)(\s+?)#s', '\1<a href="mailto:\2">\2</a>\3', $whois);
$whois = preg_replace('#(\s+?)(http://.*?)(\s+?)#s', '\1<a href="\2" target="_blank">\2</a>\3', $whois);
$template->assign_vars(array(
'WHOIS' => trim($whois))
);
}
$db->sql_freeresult($result);
// Output the page
page_header($user->lang['WHO_IS_ONLINE']);
$template->set_filenames(array(
'body' => 'viewonline_whois.html')
);
make_jumpbox('viewforum.'.$phpEx);
page_footer();
}
// Forum info // Forum info
$sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id
@ -187,11 +222,13 @@ while ($row = $db->sql_fetchrow($result))
'USERNAME' => $username, 'USERNAME' => $username,
'LASTUPDATE' => $user->format_date($row['session_time']), 'LASTUPDATE' => $user->format_date($row['session_time']),
'FORUM_LOCATION'=> $location, 'FORUM_LOCATION'=> $location,
'USER_IP' => ($auth->acl_get('a_')) ? $row['session_ip'] : $user->lang['HIDDEN'], 'USER_IP' => ($auth->acl_get('a_')) ? (($mode == 'lookup' && $user_id == $row['user_id']) ? gethostbyaddr($row['session_ip']) : $row['session_ip']) : '',
'S_ROW_COUNT' => $$which_counter, 'S_ROW_COUNT' => $$which_counter,
'U_USER_PROFILE' => ($row['user_type'] <> USER_IGNORE) ? "memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['user_id'] : '', 'U_USER_PROFILE' => ($row['user_type'] <> USER_IGNORE) ? "memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['user_id'] : '',
'U_USER_IP' => "viewonline.$phpEx$SID" . (($mode != 'lookup') ? '&amp;mode=lookup&amp;u=' . $row['user_id'] : ''),
'U_WHOIS' => "viewonline.$phpEx$SID&amp;mode=whois&amp;u=" . $row['user_id'],
'U_FORUM_LOCATION' => $location_url) 'U_FORUM_LOCATION' => $location_url)
); );