I got tired of cutting/pasting IP addresses from my access/error logs to www.whatismyip.com, so, I decided to add a little link for each record Enjoy! In /templates/admin/access_log.html: ------------------ Replace: Code: {foreach from=$list item=p} <tr class={cycle values="xx,odd"}> <td> {$p.time|date_format:$config.time_format} </td> <td> <a href="users.php?action=edit&member_id={$p.member_id}">{$p.login}</a> </td> <td> {$p.url|escape} </td> {if !$config.demo} <td> {$p.remote_addr|escape} </td> {/if} <td> {$p.referrer|escape} </td> </tr> {/foreach} With: Code: {foreach from=$list item=p name=loop} <tr class={cycle values="xx,odd"}> <td> {$p.time|date_format:$config.time_format} </td> <td> <a href="users.php?action=edit&member_id={$p.member_id}">{$p.login}</a> </td> <td> {$p.url|escape} </td> {if !$config.demo} <td> {$p.remote_addr|escape} <span style="font-size: 9px;"><a href="#" onclick="document.ip_lookup_form{$smarty.foreach.loop.iteration}.submit()">Lookup</a></span> <span style="font-size: 9px;"><a href="#" onclick="document.whois_lookup_form{$smarty.foreach.loop.iteration}.submit()">WHOIS</a></span> <FORM METHOD="POST" ACTION="http://www.whatismyip.com/tools/ip-address-lookup.asp" TARGET="_blank" NAME="ip_lookup_form{$smarty.foreach.loop.iteration}"> <input type="hidden" name="IP" value="{$p.remote_addr|escape}" /> <input type="hidden" value="Lookup" name="GL" /> </FORM> <FORM METHOD="POST" ACTION="http://www.whatismyip.com/tools/ip-whois-lookup.asp" TARGET="_blank" NAME="whois_lookup_form{$smarty.foreach.loop.iteration}"> <input type="hidden" name="IP" value="{$p.remote_addr|escape}" /> <input type="hidden" value="Whois Lookup" name="WL" /> </FORM> </td> {/if} <td> {$p.referrer|escape} </td> </tr> {/foreach} In /templates/admin/error_log.html: ------------------ Replace: Code: {foreach from=$list item=p} <tr> <td> {$p.time|date_format:$config.time_format} </td> <td> {$p.url|truncate:60|escape} </td> {if !$config.demo} <td> {$p.remote_addr|escape} </td> {/if} <td> <SMALL>{$p.error|escape|replace:"<br>":"<br>"|replace:"<br />":"<br />"}</SMALL> </td> </tr> {/foreach} With: Code: {foreach from=$list item=p name=loop} <tr> <td> {$p.time|date_format:$config.time_format} </td> <td> {$p.url|truncate:60|escape} </td> {if !$config.demo} <td> {$p.remote_addr|escape} <span style="font-size: 9px;"><a href="#" onclick="document.ip_lookup_form{$smarty.foreach.loop.iteration}.submit()">Lookup</a></span> <span style="font-size: 9px;"><a href="#" onclick="document.whois_lookup_form{$smarty.foreach.loop.iteration}.submit()">WHOIS</a></span> <FORM METHOD="POST" ACTION="http://www.whatismyip.com/tools/ip-address-lookup.asp" TARGET="_blank" NAME="ip_lookup_form{$smarty.foreach.loop.iteration}"> <input type="hidden" name="IP" value="{$p.remote_addr|escape}" /> <input type="hidden" value="Lookup" name="GL" /> </FORM> <FORM METHOD="POST" ACTION="http://www.whatismyip.com/tools/ip-whois-lookup.asp" TARGET="_blank" NAME="whois_lookup_form{$smarty.foreach.loop.iteration}"> <input type="hidden" name="IP" value="{$p.remote_addr|escape}" /> <input type="hidden" value="Whois Lookup" name="WL" /> </FORM> </td> {/if} <td> <SMALL>{$p.error|escape|replace:"<br>":"<br>"|replace:"<br />":"<br />"}</SMALL> </td> </tr> {/foreach} In /templates/admin/user_access_log.html: ------------------ Replace: Code: {foreach from=$list item=p} <tr class={cycle values="xx,odd"}> <td> {$p.time|date_format:$config.time_format} </td> <td> {$p.login} </td> <td> {$p.url|escape} </td> <td> {$p.remote_addr|escape} </td> <td> {$p.referrer|escape} </td> </tr> {/foreach} With: Code: {foreach from=$list item=p name=loop} <tr class={cycle values="xx,odd"}> <td> {$p.time|date_format:$config.time_format} </td> <td> {$p.login} </td> <td> {$p.url|escape} </td> <td> {$p.remote_addr|escape} <span style="font-size: 9px;"><a href="#" onclick="document.ip_lookup_form{$smarty.foreach.loop.iteration}.submit()">Lookup</a></span> <span style="font-size: 9px;"><a href="#" onclick="document.whois_lookup_form{$smarty.foreach.loop.iteration}.submit()">WHOIS</a></span> <FORM METHOD="POST" ACTION="http://www.whatismyip.com/tools/ip-address-lookup.asp" TARGET="_blank" NAME="ip_lookup_form{$smarty.foreach.loop.iteration}"> <input type="hidden" name="IP" value="{$p.remote_addr|escape}" /> <input type="hidden" value="Lookup" name="GL" /> </FORM> <FORM METHOD="POST" ACTION="http://www.whatismyip.com/tools/ip-whois-lookup.asp" TARGET="_blank" NAME="whois_lookup_form{$smarty.foreach.loop.iteration}"> <input type="hidden" name="IP" value="{$p.remote_addr|escape}" /> <input type="hidden" value="Whois Lookup" name="WL" /> </FORM> </td> <td> {$p.referrer|escape} </td> </tr> {/foreach}
Ok -- I just updated this posting with the following modifications: * Added "WHOIS" link in addition to the "Lookup" link * Made the links MUCH smaller (helps sooo much with formatting!) * Added the links to user_access_log.html as well
An example would be when you see suspicious activity in your access logs and you want to research information about the IP address (to match up with customer location, etc)
Skip, I thought so. But IP address is often changed -- maybe one day it'll be in Germany, next day, it may be in Italy. No IP addresses stay in same country or location for long (I don't recall how long IP addresses usually are assigned to one location -- I think few days). So looking up IP next day may not be much of help. Am I wrong? (P.S. Thanks for taking the time to educate me (and others)).
Well, that's exactly why it's helpful - if you see that certain account's IP is bouncing all over the world, that will tell you right there that it might have been compromised or something
this is very useful. Is there a way it could be altered to just display the country of the IP right there in the amember dashboard?
not quite the country but full ISP details. This is a partial edit of amember/templates/admin/user_access_log.php Code: <table class=hedit width=70%> <tr> <th>Time</th> <th>Member</th> <th>URL</th> <th>Remote IP</th> <th>ISP</th> <!-- NEW--> <th>HTTP Referrer</th> </tr> {foreach from=$list item=p} <!-- This entire php section is NEW. It extracts the p array from smarty and looks up the ISP details --> {php} $p = $this->get_template_vars('p'); $ip = $p['remote_addr']; $fullhost = gethostbyaddr($ip); $host = preg_replace("/^[^.]+./", "", $fullhost); {/php} <!-- end new PHP section --> <tr class={cycle values="xx,odd"}> <td> {$p.time|date_format:$config.time_format} </td> <td> {$p.login} </td> <td> {$p.url|escape} </td> <td> {$p.remote_addr|escape} </td> <td> <?php echo $fullhost ?> </td> <!-- NEW --> <td> {$p.referrer|escape} </td> </tr> {/foreach} Peter
I just wanted to be clear that I relinquish all copyrights on my code in this thread (in hopes that Alex will add it, or something similar, to the standard aMember distribution.)