forum.coppermine-gallery.net
Support => cpg1.4.x Support => Older/other versions => cpg1.4 plugins => Topic started by: will on February 11, 2007, 10:06:56 pm
-
I was just lookin at Nibblers coppermine site and noticed that when a member comes online it shows a country flag next to there username, I was just wondering weather anybody or nibbler would be able to let me know how to show them on my site
Thanks ;D
-
Pickup the GeoIP binary database from http://www.maxmind.com/app/geoip_country
Decompress it into the onlinestats plugin folder
Get http://www.maxmind.com/download/geoip/api/php/geoip.inc and put it in the same place
into the codebase.php add this code
include_once("plugins/onlinestats/geoip.inc");
$gi = geoip_open("plugins/onlinestats/GeoIP.dat",GEOIP_STANDARD);
into the top of the online_mainpage() function
and further down the while loop becomes
while ($row = mysql_fetch_assoc($result)) {
$cc = strtolower(geoip_country_code_by_addr($gi, $row['user_ip']));
$value = '';
if (file_exists("images/flags/$cc.gif")) $value = ' <img src="images/flags/'.$cc.'.gif" alt="flag"/>';
$logged_in_array[] = "<a href=\"profile.php?uid={$row['user_id']}\">{$row['user_name']}</a> $value";
}
and make sure you get the user_ip from the db query
$result = cpg_db_query("SELECT user_id, user_name, user_ip FROM {$CONFIG['TABLE_ONLINE']} WHERE user_id <> 0");
My code probably differs from the plugin so you'll have to work out the exact code for yourself.
-
thank you nibbler ;D