WordPress.org

Ready to get started?Download WordPress

Forums

FeedStats
[resolved] Please update feedstats_get_ip() (2 posts)

  1. Ben
    Member
    Plugin Author

    Posted 2 years ago #

    Hey there, thanks for the great plugins!

    Because of this, I'm glad I can contribute a little. It looks like IP addresses aren't recorded correctly and lead to lots of redundant entries that aren't updated (last_time etc.) if you're behind a reverse proxy.

    I updated feedstats_get_ip() to

    function feedstats_get_ip() {
    	global $_SERVER;  
    
    	if (isset($_SERVER['REMOTE_ADDR'])) {
    		return($_SERVER['REMOTE_ADDR']);
    	} else if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    		$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    		$ip = explode(", ", $ip);
    		$ip = $ip[0];
    		return($ip);
    	} else if (isset($_SERVER['HTTP_CLIENT_IP'])) {
    		return($_SERVER['HTTP_CLIENT_IP']);
    	} else {
    		return($_SERVER['REMOTE_HOST']);
    	}
    }

    Thank you so much!

    - Ben

    http://wordpress.org/extend/plugins/feedstats-de/

  2. Frank
    Member
    Plugin Author

    Posted 1 year ago #

    included

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic