Author Topic: [MOD] Country flags (based on IP) in whos online in ACP  (Read 110840 times)

0 Members and 1 Guest are viewing this topic.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[MOD] Country flags (based on IP) in whos online in ACP
« on: March 13, 2005, 11:00:43 PM »
This mod will show country flags of your visitors in "Who's online?" in ACP (Admin Control Panel)




--------- [ Installation ] ------------

Step 1
Visit the home page of the tools will be used in this mod:
http://www.maxmind.com/app/geoip_country
Read 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.inc
Save it in includes/ directory of your 4images installation

2) http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
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) 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 2
Open admin/home.php
Find:
Code: [Select]
   $prev_ip = "";
Insert below:
Code: [Select]
/*
  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.1
Find:
Code: [Select]
       echo "<td>".$username.$invisibleuser."</td>\n";
Insert above:
Code: [Select]
/*
  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.2
Find:
Code: [Select]
       echo "<td>".$lang['userlevel_guest']."</td>\n";
Replace with:
Code: [Select]
/*
  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
*/
« Last Edit: August 21, 2010, 08:31:10 PM by V@no »
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: [MOD] Country flags (based on IP) in whos online in ACP
« Reply #1 on: March 14, 2005, 12:10:26 AM »
Great Mod. Thanks for this  :D
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline AntiNSA2

  • Hero Member
  • *****
  • Posts: 774
  • As long as I can finish my site before I die.
    • View Profile
    • http://www.thelifephotography.com
Re: [MOD] Country flags (based on IP) in whos online in ACP
« Reply #2 on: March 14, 2005, 02:28:07 PM »
Um, does this mod have something to do with the way you got the flags to be listed for whos currently online in the home page (not admin control panel)on your website?

Or did you somehow do that with pphlogger (Thank god I got that one before it was gone) 8O
As long as I can finish my site before I die.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Country flags (based on IP) in whos online in ACP
« Reply #3 on: March 14, 2005, 02:37:37 PM »
Um, does this mod have something to do with the way you got the flags to be listed for whos currently online in the home page (not admin control panel)on your website?
yes, its based on this too. Maybe in time I'll post it too ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] Country flags (based on IP) in whos online in ACP
« Reply #4 on: March 14, 2005, 04:25:18 PM »
wonderful! I like that!

I guess I'll implement that tonight  :)

Thank you V@no  :D

MAяTRIX


Offline Vincent

  • 4images Moderator
  • Addicted member
  • *****
  • Posts: 1.195
    • View Profile
    • www.foto-kocher.com
Re: [MOD] Country flags (based on IP) in whos online in ACP
« Reply #5 on: March 14, 2005, 06:48:15 PM »
Hello V@no
as i know the IP code is not fixed to a country! This only should work with IP.v6

vincent
Beati pauperi spiritus

4images 1.7 // My Installed Mods


Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] Country flags (based on IP) in whos online in ACP
« Reply #6 on: March 14, 2005, 11:03:13 PM »
Vincent, that's not really exact - a lot of IP's are assigned to an ISP ;) and this Internet Service Provider provides this internet service in a certain country ;)
if you check 83.148.16.15 there's a 95 % chance that the user comes from the Czech Republic or if you'll search for 148.120.16.15 it in 95 cases of 100 it could be a visitor from Norway...
 8)



2 V@no: Great thing! It works fine. Thank you for this mod again  :lol:
I'm looking forward to see your next mod   :wink:
« Last Edit: March 14, 2005, 11:10:39 PM by martrix »
MAяTRIX


Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: [MOD] Country flags (based on IP) in whos online in ACP
« Reply #7 on: March 14, 2005, 11:08:52 PM »
Hi there,

is there a way to see the flags on the whos_online.html ??????

Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] Country flags (based on IP) in whos online in ACP
« Reply #8 on: March 14, 2005, 11:15:22 PM »
is there a way to see the flags on the whos_online.html ?
sure  :wink:
did you read through the posts?

Um, does this mod have something to do with the way you got the flags to be listed for whos currently online in the home page (not admin control panel)on your website?
yes, its based on this too. Maybe in time I'll post it too ;)
« Last Edit: March 14, 2005, 11:16:59 PM by martrix »
MAяTRIX


Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: [MOD] Country flags (based on IP) in whos online in ACP
« Reply #9 on: March 14, 2005, 11:18:57 PM »
Thanks, i doesn´t read it. Now i wait.....  :roll:
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: [MOD] Country flags (based on IP) in whos online in ACP
« Reply #10 on: March 15, 2005, 02:12:26 AM »
Hi I have installed this MOD but I think that this is not working right because this said that I am in japon :S and now I'm USA and The ips from Spain are not show with a spanish flag they are show as a LAN IP any of the ips correspond with the flag   :cry: :cry: :cry: :? :? :? :?


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Country flags (based on IP) in whos online in ACP
« Reply #11 on: March 15, 2005, 03:07:19 AM »
can u PM me with a few IPs from spain and your IP (which shows as Japan)?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: [MOD] Country flags (based on IP) in whos online in ACP
« Reply #12 on: March 15, 2005, 05:43:06 AM »
of course  :wink: I think that the ips are from spain  :oops: but i am not sure, by the way where did u get those flags,they are awesome, the ones on your image
----------------------------------------------------
update
I have found the flags!!!


http://www.hahn-hotel.com/flags/zip/world.small.zip
« Last Edit: March 15, 2005, 11:21:35 PM by ascanio »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Country flags (based on IP) in whos online in ACP
« Reply #13 on: March 15, 2005, 05:49:10 AM »
by the way where did u get those flags,they are awesome, the ones on your image
tell u the truth - I dont remmember... :oops:
but I'm sure I googled them :D
« Last Edit: March 15, 2005, 06:04:08 AM by V@no »
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: [MOD] Country flags (based on IP) in whos online in ACP
« Reply #14 on: March 15, 2005, 05:52:37 AM »
I just send it to you the ips in a PM ;)