This mod will show country flags of your visitors in "Who's online?" in ACP (Admin Control Panel)
--------- [ Installation ] ------------Step 1Visit the home page of the tools will be used in this mod:
http://www.maxmind.com/app/geoip_countryRead the licence and make sure its NOT conflicts with your usage.
Download the following files:
1)
http://www.maxmind.com/download/geoip/api/php/geoip.incSave it in
includes/ directory of your 4images installation
2)
http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gzExtract the content of this archive (u can use WinZIP, WinRAR, 7-Zip or any other archivers)
Save the extracted file (GeoIP.dat) into
includes/ directory (make sure u keep the case: its
GeoIP.dat not
geoip.dat)
3) Download and extract
flags.zip file from the attachment below.
Save the files into
flags/ folder in your 4images root directory.
The attached GeoIP.20100809.zip file should only be used as a backup, only if provided download links no longer working, because it might be out of date.
Step 2Open
admin/home.phpFind:
$prev_ip = "";
Insert
below:
/*
MOD VISITORS COUNTRY FLAGS
START INSERT
*/
if (!class_exists("GeoIP"))
{
include(ROOT_PATH."includes/geoip.inc");
}
$gi = geoip_open(ROOT_PATH."includes/GeoIP.dat",GEOIP_STANDARD);
$countries = array();
/*
MOD VISITORS COUNTRY FLAGS
END INSERT
*/
Step 2.1Find:
echo "<td>".$username.$invisibleuser."</td>\n";
Insert
above:
/*
MOD VISITORS COUNTRY FLAGS
START INSERT
*/
$cid = geoip_country_code_by_addr($gi, $row['session_ip']);
if (empty($cid)) $cid = "lan";
$countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1 : 1;
$username = "<img src=\"".ROOT_PATH."flags/".strtolower($cid).".gif"."\" alt=\"".(($cid != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$cid]] : "Unknown or LAN")."\" border=0> ".$username;
/*
MOD VISITORS COUNTRY FLAGS
END INSERT
*/
Step 2.2Find:
echo "<td>".$lang['userlevel_guest']."</td>\n";
Replace with:
/*
MOD VISITORS COUNTRY FLAGS
ORIGINAL BLOCK:
echo "<td>".$lang['userlevel_guest']."</td>\n";
*/
/*
MOD VISITORS COUNTRY FLAGS
START REPLACE
*/
$cid = geoip_country_code_by_addr($gi, $row['session_ip']);
if (empty($cid)) $cid = "lan";
$countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1 : 1;
echo "<td><img src=\"".ROOT_PATH."flags/".strtolower($cid).".gif"."\" alt=\"".(($cid != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$cid]] : "Unknown or LAN")."\" border=0> ".$lang['userlevel_guest']."</td>\n";
/*
MOD VISITORS COUNTRY FLAGS
END REPLACE
*/