This plugin is dependent on WP/GeoTrack by Johannes Lietz, this is NOT a stand-alone plugin, it won’t work if WP/GeoTrack is not installed anyway, so it’s safe.
And don’t look for it in WP Plugins repo, you won’t find it there
/*
Plugin Name: Top Visitors Flag
Plugin URI: http://www.marvinmarcelo.com/
Description: This plugin displays visitors on sidebar as widget dependent on WP/GEO-Track plugin.
Author: Marvin Marcelo
Author URI: http://www.marvinmarcelo.com/
Version: 1.0.0
*/
function tvf_get_topvisits()
{
global $wpdb, $table_prefix;
$sql = "select count(*) as `rows` , `country` , `flagname` from `".$table_prefix."geotrack` group by `country` order by `rows` desc limit 0 , 12";
$flagstats = $wpdb->get_results($sql);
$html = "
Top Visiting Countries
\n"; /* id string */
foreach ($flagstats as $cf)
{
$cf->rows = number_format($cf->rows, 0, "", ",");
$html .= "
flagname . ".png\" alt=\"Flag of $cf->country with $cf->rows visits\" title=\"$cf->country with $cf->rows visits\" />\n";
}
$html .= "
Also, you have to forgive the function, constants, and variables names, we all struggle for a better and sensible one
Happy coding!