<?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>'; }
/** * 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 ''; }
} foreach (array_keys($_COOKIE) as $key) { $_COOKIE[$key] = stripslashes($_COOKIE[$key]); } $_REQUEST = array_merge($_GET, $_POST); } define('SIMPLE_STATS_PATH', realpath(dirname(__FILE__))); if (file_exists(SIMPLE_STATS_PATH . '/config.php')) { require_once SIMPLE_STATS_PATH . '/config.php'; } require_once SIMPLE_STATS_PATH . '/includes/classes.php'; require_once SIMPLE_STATS_PATH . '/includes/ua.php'; require_once SIMPLE_STATS_PATH . '/includes/functions.php'; include_once SIMPLE_STATS_PATH . '/includes/countries.php'; $page = isset($_GET['p']) && in_array($_GET['p'], array('paths', 'overview', 'options', 'js', 'login', 'logout')) ? $_GET['p'] : 'overview'; $ss = new SimpleStats(); if (!$ss->is_installed()) { // check whether we've just finished setup if (isset($_POST['action']) && $_POST['action'] == 'complete_setup') { $ss->setup_options(); } else { $page = 'setup'; require_once SIMPLE_STATS_PATH . '/includes/setup.php'; exit; } } date_default_timezone_set($ss->options['tz']); if ($page == 'logout' || needs_authentication()) { if ($page == 'logout') { logout(); }