Simple Login Log
show failed logins in a table and link to lookup service (2 posts)

  1. mr_swede
    Posted 4 years ago #

    I found a way to publish dangerous IP Addresses on my site by creating a post/page with the following php code. With dangerous I mean IP addresses that have many failed login attempts, trying to access my site.

    For this You need a plugin that allows execution of php code within posts.

    My question is how the IP addresses echoed in the table can be clickable and link to an IP Address geolocation service, such as http://whatismyipaddress.com/ip/ (that IP has 4893 failed login attempts on my site!)

    echo "<table><tr><td><strong>IP</strong></td><td align=right><strong>No. of Attempts</strong></td><td align=right><strong>Last attempt</strong></td></tr>";
    global $wpdb;
    $result = $wpdb->get_results(
    SELECT ip AS IP, COUNT( ip ) AS  'Failed', MAX(Time) AS Latest
    FROM wp_simple_login_log
    WHERE login_result =  '0'
    GROUP BY ip
    ORDER BY Failed DESC
    Limit 0,20
    foreach($result as $row) {
        echo "<tr><td>$row->IP</td><td align=right>$row->Failed</td><td align=right>$row->Latest</td></tr>";
    echo "</table>";


  2. chewriter
    Posted 3 years ago #

    Hi, did you try the option, described in readme? I mean something like the last section of code:

    add_filter( 'sll-output-data', 'link_location_by_ip' );
    function link_location_by_ip($item){
    	//$item is a single row for columns with their values
    	$item['ip'] = sprintf('<a target="_blank"  href="http://infosniper.net/index.php?ip_address=%1$s&map_source=3&two_maps=1&overview_map=1&lang=1&map_type=1&zoom_level=11">%1$s</a>', $item['ip']);
    	return $item;

    I belive that in your case should be something like this:

    foreach($result as $row) {
        echo "<tr><td>sprintf('<a target="_blank"  href="http://whatismyipaddress.com/ip/%1$s#Geolocation-Information">%1$s</a>', $row->IP)</td><td align=right>$row->Failed</td><td align=right>$row->Latest</td></tr>";

    But IP should be in text format, like $item = "", and not the number

    Actually, I'm more interesting in logging of the failed passwords together with logins as described here. And the time since last attempt, like here. Now I need to have both plugins activated... It would be great if both functionality will be included into the simple-login-log plugin in next release... Please.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Simple Login Log
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic