When investigating users with multiple IPs, I've been having to do manual lookups on IP Addresses, trying to gauge which networks users were coming from. i.e. A user has 3 IPs in an hour, one leads to Verizon in San Francisco, one to a dial-up carrier in New England, and one to Time Warner in Buffalo. Obviously this is not the same person. But until this, I had to manually copy & paste the IPs out and do host lookup. Warning: It's possible that if your server's DNS is not configured correctly, it could slow down the loading of your Access Log pages. Ours have not slowed at all, but still it is possible. Version: 3.1.8PRO Backup your site before making any modifications! STEP 1 - Add dns_name Variable In /amember/admin/users.php, find this function: Code: function display_access_log(){ global $member_id; global $start, $count; global $all_count; global $db, $t; if (!$count) $count = 20; $list = $db->get_access_log($member_id, $start, $count); $all_count = $db->get_access_log_c($member_id); $t->assign('list', $list); $t->assign('count', $count); $t->display("admin/user_access_log.html"); } CHANGE it to this: Code: function display_access_log(){ global $member_id; global $start, $count; global $all_count; global $db, $t; if (!$count) $count = 20; $list = $db->get_access_log($member_id, $start, $count); $all_count = $db->get_access_log_c($member_id); // Added to display hostname of IP foreach( $list as $k1 => $v1 ){ foreach( $list[$k1] as $k2 => $v2 ){ $hostname = gethostbyaddr( $list[$k1]['remote_addr'] ); if( $hostname != $list[$k1]['remote_addr'] ){ $list[$k1]['dns_name'] = $hostname; } else { $list[$k1]['dns_name'] = "N/A"; } } } $t->assign('list', $list); $t->assign('count', $count); $t->display("admin/user_access_log.html"); } STEP 2 - Add dns_name to Access Log Display In /amember/templates/user_access_log.html, around line 20, change this line: Code: <td> {$p.remote_addr|escape}/td> to this: Code: <td> {$p.remote_addr|escape}<br /> <span style="font-size: 10px;">{$p.dns_name|escape}</span> </td>
Hi excellent hack. I have added it to my info page and added the global list to it as well. See http://jlogica.com/apps/info/amember:hacks:display-dns-for-ip hope you don't mind, but I lose little nifty things like this in the forums. Note: If any one has a hack that they want put into the info send it over and I will add it, would be good to have a spot for bits and pieces to make life easier. Cheers, Larry
This is a bug fix to the code above. Note the code that is in bold. Code: function display_access_log(){ global $member_id; global $start, $count; global $all_count; global $db, $t; if (!$count) $count = 20; $list = $db->get_access_log($member_id, $start, $count); $all_count = $db->get_access_log_c($member_id); // Added to display hostname of IP [B] if (is_array($list)) {[/B] foreach( $list as $k1 => $v1 ){ foreach( $list[$k1] as $k2 => $v2 ){ $hostname = gethostbyaddr( $list[$k1]['remote_addr'] ); if( $hostname != $list[$k1]['remote_addr'] ){ $list[$k1]['dns_name'] = $hostname; } else { $list[$k1]['dns_name'] = "N/A"; } } } [B]}[/B] $t->assign('list', $list); $t->assign('count', $count); $t->display("admin/user_access_log.html"); }