Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Country Flags On Who's Online Block  (Read 3966 times)

0 Members and 1 Guest are viewing this topic.

will

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 263
Country Flags On Who's Online Block
« 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
Logged

Nibbler

  • Guest
Re: Country Flags On Who's Online Block
« Reply #1 on: February 11, 2007, 10:16:26 pm »

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

Code: [Select]
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

Code: [Select]
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

Code: [Select]
$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.

Logged

will

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 263
Re: Country Flags On Who's Online Block
« Reply #2 on: February 11, 2007, 10:22:10 pm »

thank you nibbler ;D
Logged
Pages: [1]   Go Up
 

Page created in 0.026 seconds with 19 queries.