/** * Determines the visitor's country based on their IP address. * You can supply your own GeoIP information (two-letter country code) by * definining a constant SIMPLE_STATS_GEOIP_COUNTRY containing this value. */ private function determine_country($_ip) { if (defined('SIMPLE_STATS_GEOIP_COUNTRY') && strlen(SIMPLE_STATS_GEOIP_COUNTRY) <= 2) { return SIMPLE_STATS_GEOIP_COUNTRY; } if (SimpleStats::is_geoip()) { if (!function_exists('geoip_open') && !class_exists('GeoIP')) { // it's possible the user has another instance running include_once SIMPLE_STATS_PATH . '/geoip/geoip.php'; } $gi = geoip_open(SIMPLE_STATS_PATH . '/geoip/GeoIP.dat', GEOIP_STANDARD); $result = geoip_country_code_by_addr($gi, $_ip); geoip_close($gi); return $result; } return ''; }
<?php if (!$ajax) { echo '<footer><a href="http://rayofsolaris.net/code/simple-stats">Simple Stats v' . SimpleStats::version . '</a>' . (SimpleStats::is_geoip() ? '<small> This product includes GeoLite data created by MaxMind, available from <a href="http://www.maxmind.com/" rel="external">maxmind.com</a>.</small>' : '') . '</footer>'; } echo '</div>'; // container if (!empty($script_i18n)) { echo '<script>var i18n = ' . json_encode($script_i18n) . ';</script>'; }