hi all
This mod will show country flags of your visitors in "Who's online?" in home page !!!
demo
Visit 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://www.maxmind.com/download/geoip/database/GeoIP.dat.gz <- Please Download from Attachment!Extract 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)
http://www.maxmind.com/download/geoip/database/flag.zipor
http://web.tampabay.rr.com/vano/redirect.html?flags.zipExtract the flags (again, any compatible archivers would work, Windows XP users dont need any 3-party tools for that)
Save the files into
flags/ folder in your 4images root directory.
For visitors with "unknown" or LAN IPs, save this image:
as
lan.gif into
flags/ folder as well
For visitors with using satelite service, save this image:
as
a2.gif into
flags/ folder.
4) Open Files : includes/sessions.php
Find:
Code:
//-----------------------------------------------------
//--- Start Configuration -----------------------------
//-----------------------------------------------------
Add above
Code:
/*
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
*/
Find:
Code:
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $row['session_user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['session_user_id'];
Add after
Code:
/*
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
*/
Find:
Code:
$num_guests_online++;
Add after
Code:
/*
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;
$invitado_online_list = "<font color=\"#00FFFF\">".$num_guests_online."</font><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> ".$invitado_online_list ;
/*
MOD VISITORS COUNTRY FLAGS
END INSERT
*/
if ($num_guests_online > 1){
$invitado_online_list .= " , ";
}
Find:
Code:
"num_guests_online" => $num_guests_online,
Add after
Code:
"invitado_online_list" => $invitado_online_list,
save changes
5?) Open templates/<your templates>/whos_online.html
Add
{invitado_online_list}
save changes