function construct_ip_register_table($ipaddress, $prevuserid, $depth = 1) { global $vbulletin, $vbphrase; $depth--; if (VB_AREA == 'AdminCP') { $userscript = 'usertools.php'; } else { $userscript = 'user.php'; } if (substr($ipaddress, -1) == '.' or substr_count($ipaddress, '.') < 3) { // ends in a dot OR less than 3 dots in IP -> partial search $ipaddress_match = "ipaddress LIKE '" . $vbulletin->db->escape_string_like($ipaddress) . "%'"; } else { // exact match $ipaddress_match = "ipaddress = '" . $vbulletin->db->escape_string($ipaddress) . "'"; } $users = $vbulletin->db->query_read_slave("\n\t\tSELECT userid, username, ipaddress\n\t\tFROM " . TABLE_PREFIX . "user AS user\n\t\tWHERE {$ipaddress_match} AND\n\t\t\tipaddress <> '' AND\n\t\t\tuserid <> {$prevuserid}\n\t\tORDER BY username\n\t"); $retdata = ''; while ($user = $vbulletin->db->fetch_array($users)) { $retdata .= '<li>' . "<a href=\"user.php?" . $vbulletin->session->vars['sessionurl'] . "do=" . iif(VB_AREA == 'ModCP', 'viewuser', 'edit') . "&u={$user['userid']}\"><b>{$user['username']}</b></a> \n\t\t\t<a href=\"{$userscript}?" . $vbulletin->session->vars['sessionurl'] . "do=gethost&ip={$user['ipaddress']}\" title=\"" . $vbphrase['resolve_address'] . "\">{$user['ipaddress']}</a> " . construct_link_code($vbphrase['find_posts_by_user'], "../search.php?" . $vbulletin->session->vars['sessionurl'] . "do=finduser&u={$user['userid']}", '_blank') . construct_link_code($vbphrase['view_other_ip_addresses_for_this_user'], "{$userscript}?" . $vbulletin->session->vars['sessionurl'] . "do=doips&u={$user['userid']}&hash=" . CP_SESSIONHASH) . "</li>\n"; if ($depth > 0) { $retdata .= construct_user_ip_table($user['userid'], $user['ipaddress'], $depth); } } if (empty($retdata)) { return ''; } else { return '<ul>' . $retdata . '</ul>'; } }
function construct_ip_register_table($ipaddress, $prevuserid, $depth = 1) { global $vbulletin, $vbphrase; $depth--; if (VB_AREA == 'AdminCP') { $userscript = 'usertools.php'; } else { $userscript = 'user.php'; } try { $users = vB_Api::instanceInternal('user')->searchUsersByIp($ipaddress, $depth); } catch (vB_Exception_Api $ex) { throw new $ex(); } $retdata = ''; if ($users = @array_pop($users['regipusers'])) { foreach ($users as $user) { $retdata .= '<li>' . "<a href=\"user.php?" . vB::getCurrentSession()->get('sessionurl') . "do=" . iif(VB_AREA == 'ModCP', 'viewuser', 'edit') . "&u={$user['userid']}\"><b>{$user['username']}</b></a> \n\t\t\t\t<a href=\"{$userscript}?" . vB::getCurrentSession()->get('sessionurl') . "do=gethost&ip={$user['ipaddress']}\" title=\"" . $vbphrase['resolve_address'] . "\">{$user['ipaddress']}</a> " . construct_link_code($vbphrase['find_posts_by_user'], "../search.php?" . vB::getCurrentSession()->get('sessionurl') . "do=finduser&u={$user['userid']}", '_blank') . construct_link_code($vbphrase['view_other_ip_addresses_for_this_user'], "{$userscript}?" . vB::getCurrentSession()->get('sessionurl') . "do=doips&u={$user['userid']}&hash=" . CP_SESSIONHASH) . "</li>\n"; if ($depth > 0) { $retdata .= construct_user_ip_table($user['userid'], $user['ipaddress'], $depth); } } } if (empty($retdata)) { return ''; } else { return '<ul>' . $retdata . '</ul>'; } }
$hostname = $vbphrase['could_not_resolve_hostname']; } print_description_row("<div style=\"margin-" . vB_Template_Runtime::fetchStyleVar('left') . ":20px\"><a href=\"usertools.php?" . vB::getCurrentSession()->get('sessionurl') . "do=gethost&ip=" . $vbulletin->GPC['ipaddress'] . "\">" . $vbulletin->GPC['ipaddress'] . "</a> : <b>{$hostname}</b></div>"); $results = construct_ip_usage_table($vbulletin->GPC['ipaddress'], 0, $vbulletin->GPC['depth']); print_description_row($vbphrase['post_ip_addresses'], false, 2, 'thead'); print_description_row($results ? $results : $vbphrase['no_matches_found_gerror']); $results = construct_ip_register_table($vbulletin->GPC['ipaddress'], 0, $vbulletin->GPC['depth']); print_description_row($vbphrase['registration_ip_addresses'], false, 2, 'thead'); print_description_row($results ? $results : $vbphrase['no_matches_found_gerror']); print_table_footer(); } if ($userid) { print_form_header('', ''); print_table_header(construct_phrase($vbphrase['ip_address_search_for_user_x'], htmlspecialchars_uni($vbulletin->GPC['username']))); print_label_row($vbphrase['registration_ip_address'], $userinfo['ipaddress'] ? $userinfo['ipaddress'] : $vbphrase['n_a']); $results = construct_user_ip_table($userid, 0, $vbulletin->GPC['depth']); print_description_row($vbphrase['post_ip_addresses'], false, 2, 'thead'); print_description_row($results ? $results : $vbphrase['no_matches_found_gerror']); if ($userinfo['ipaddress']) { $results = construct_ip_register_table($userinfo['ipaddress'], $userid, $vbulletin->GPC['depth']); } else { $results = ''; } print_description_row($vbphrase['registration_ip_addresses'], false, 2, 'thead'); print_description_row($results ? $results : $vbphrase['no_matches_found_gerror']); print_table_footer(); } } print_form_header('usertools', 'doips'); print_table_header($vbphrase['search_ip_addresses_gcpuser']); print_input_row($vbphrase['find_users_by_ip_address'], 'ipaddress', $vbulletin->GPC['ipaddress'], 0);