get_country_codes(); $result = $wpdb->get_results("SELECT DISTINCT `location` FROM `{$wpdb->prefix}statistics_visitor`"); $rangestartdate = $WP_Statistics->real_current_date('Y-m-d', '-0', $rangestart_utime ); $rangeenddate = $WP_Statistics->real_current_date('Y-m-d', '-0', $rangeend_utime ); foreach( $result as $item ) { $Countries[$item->location] = $wpdb->get_var( $wpdb->prepare( "SELECT count(location) FROM `{$wpdb->prefix}statistics_visitor` WHERE location=%s AND `last_counter` BETWEEN %s AND %s", $item->location, $rangestartdate, $rangeenddate ) ); } arsort($Countries); $i = 0; foreach( $Countries as $item => $value) { $i++; $item = strtoupper($item); echo "
"; echo "
$i
"; echo "
"; echo "
{$ISOCountryCode[$item]}
"; echo "
" . number_format_i18n($value) . "
"; echo "
"; } ?>