IP address tracker plugin v1.8a

Release Notes

Made for Elgg 1.8

Please use version 1.2a for older versions of Elgg

  • Works.  

    However, ip address does not pass through to utrace like in previous versions.  It passes the current user's (admin's) ip address.

    Thanks, though, great for using the banhammer on Pakistan/Chinese spammers.

  • @slyhne I find your tracker_log_ip function returns the subnet address, not the external ipaddress. For instance, in my network my subnet address is 10.0.0.14. I am connected to the internet via a cable modem. Its address is something like 173.23.43.192. Your function returns my subnet address.

    I have replaced your ip code detection with this:

    if (getenv('HTTP_CLIENT_IP')) {
                $ip_address = getenv('HTTP_CLIENT_IP');
            }
            elseif (getenv('HTTP_X_FORWARDED_FOR')) {
                $ip_address = getenv('HTTP_X_FORWARDED_FOR');
            }
            elseif (getenv('HTTP_X_FORWARDED')) {
                $ip_address = getenv('HTTP_X_FORWARDED');
            }
            elseif (getenv('HTTP_FORWARDED_FOR')) {
                $ip_address = getenv('HTTP_FORWARDED_FOR');
            }
            elseif (getenv('HTTP_FORWARDED')) {
                $ip_address = getenv('HTTP_FORWARDED');
            }
            else {
                $ip_address = $_SERVER['REMOTE_ADDR'];
            }

    if (!empty($ip_address)) {
                create_metadata($object->guid, 'ip_address', $ip_address, '', 0, ACCESS_PUBLIC);
            }

    Forgive the formatting. This returns the correct ip address - not the subnet address

  • @shyhne I also find that the ip address is not displayed in the search field. Re-setting the 'ip' input solves this problem:

    function tracker_page_handler($page_elements, $handler) {

        admin_gatekeeper();

        // Get IP
        $ip = $page_elements[0];
        if (empty($ip)) {
            $ip = get_input('ip');
        }

        // Set title
        $title = sprintf(elgg_echo('tracker:title'), $ip);

        // Get the list of all IP's
        $content = elgg_list_entities_from_metadata(array(
                                'metadata_name' => 'ip_address',
                                'metadata_value' => $ip,
                                'type' => 'user',
                                'limit' => 25
                                ));   

        //set a view to the search
        set_input( 'ip', $ip );
        $sidebar = elgg_view("tracker/search");

        $body = elgg_view_layout('content', array(
                            'filter' => '',
                            'content' => $content,
                            'title' => $title,
                            'sidebar' => $sidebar,
                            ));

        echo elgg_view_page($title, $body);

    }

  • Plugin was installed normally in Elgg 1.7.9. It was tested with a single user online, working perfectly but when tested with over 10 online users did not show the IP.

  • I use

    elgg 1.7.11

    when i enable this plugin i get this error

    Fatal error: Call to undefined function elgg_register_page_handler() in /elgg_test/mod/tracker/start.php on line 18

  • I'll see if I can look into these issues and release a bug fix - Thx for the feedback.

  • Works perfectly. Made changes as suggested by Brain. Recommended.

  • Can we get an associated plugin to limit the number of members who can register from any given IP number?

    Let's say I want to set the limit to 10 Memberships per IP (so theoretically different members of a family or a dorm room could have individual accounts but spammers would be blocked from creating more than 10).

    I'm getting huge quantities of spam memberships, with one IP creating hundreds or thousands of new user registrations. An admin shouldn't have to manually check and delete the extras. It should be possible to have the software prevent more than X memberships (at any given time) from a specific IP and to pop up a message to the New User registration if they have reached their maximum (set by the admin) telling them "You have reached the maximum number of ___ user registrations permitted from one IP address."

Stats

  • Category: Tools
  • License: GNU General Public License (GPL) version 2
  • Updated: 2018-5-1
  • Downloads: 9386
  • Recommendations: 31

Other Projects

View slyhne's plugins

Contributors