• bseddon

    (@bseddon)


    The plugin does not work when the PHP GeoIP extension is installed. There is an error in geoip.inc. The solution is simple: only load the .inc file when the extension is not used. The extension is being used if the constant GEOIP_COUNTRY_EDITION is defined. Here’s an example:

    if (!defined('GEOIP_COUNTRY_EDITION'))
    {
    	include_once('geoip.inc');
    	$geoIp = geoip_open(realpath(dirname(__FILE__))
    		.'/GeoIP.dat',GEOIP_STANDARD);
    }

    And also handle the call to get the country:

    <td><strong>
    	<?php echo defined('GEOIP_COUNTRY_EDITION')
    		? geoip_country_name_by_name($stat->ip)
    		: geoip_country_name_by_addr($geoIp, $stat->ip);
    	?>
    </strong></td>

    Then the plugin works either way.

    https://www.ads-software.com/plugins/simple-visitor-stat/

  • The topic ‘Small change to cope with the PHP GeoIP extension’ is closed to new replies.