4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
February 20, 2018, 06:42:21 AM

Login with username, password and session length
Search:     Advanced search
Follow 4images on twitter: Click here to follow!
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Modifications / Modifikationen
| |-+  Mods & Plugins (Releases & Support) (Moderators: mawenzi, Rembrandt)
| | |-+  [MOD] Country flags (based on IP) in whos online in ACP
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 3 4 5 6 » »» Print
This topic has not yet been rated!
Author Topic: [MOD] Country flags (based on IP) in whos online in ACP  (Read 81776 times)
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 565

mmm PHP...


View Profile WWW
« 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:
1
   $prev_ip = "";

Insert below:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
  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:
1
       echo "<td>".$username.$invisibleuser."</td>\n";

Insert above:
1
2
3
4
5
6
7
8
9
10
11
12
/*
  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:
1
       echo "<td>".$lang['userlevel_guest']."</td>\n";

Replace with:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
  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
*/

* GeoIP.20100809_do_not_download_this_unless_download_links_are_broken.zip (583.32 KB - downloaded 41 times.)
* flags.zip (195.1 KB - downloaded 73 times.)
« Last Edit: August 21, 2010, 08:31:10 PM by V@no » Logged

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)
JensF
Addicted member
******
Offline Offline

Posts: 1028

Thank You
-Given: 0
-Receive: 0


View Profile WWW
« Reply #1 on: March 14, 2005, 12:10:26 AM »

Great Mod. Thanks for this  Very Happy
Logged

Mit freundlichem Gru▀
Jens Funk



-> Sorry for my bad English <-
AntiNSA2
Hero Member
*****
Offline Offline

Posts: 774

Thank You
-Given: 0
-Receive: 2

As long as I can finish my site before I die.


View Profile WWW
« 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) Shocked
Logged

As long as I can finish my site before I die.
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 565

mmm PHP...


View Profile WWW
« 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 Wink
Logged

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)
martrix
Hero Member
*****
Offline Offline

Posts: 755

Thank You
-Given: 0
-Receive: 6


View Profile WWW
« Reply #4 on: March 14, 2005, 04:25:18 PM »

wonderful! I like that!

I guess I'll implement that tonight  Smile

Thank you V@no  Very Happy

Logged

MAяTRIX

Vincent
4images Moderator
Addicted member
*****
Offline Offline

Posts: 1195

Thank You
-Given: 0
-Receive: 7


View Profile WWW
« 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
Logged

Beati pauperi spiritus

4images 1.7 // My Installed Mods

martrix
Hero Member
*****
Offline Offline

Posts: 755

Thank You
-Given: 0
-Receive: 6


View Profile WWW
« 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 Wink and this Internet Service Provider provides this internet service in a certain country Wink
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...
 Cool



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

MAяTRIX

JensF
Addicted member
******
Offline Offline

Posts: 1028

Thank You
-Given: 0
-Receive: 0


View Profile WWW
« 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 ??????

Logged

Mit freundlichem Gru▀
Jens Funk



-> Sorry for my bad English <-
martrix
Hero Member
*****
Offline Offline

Posts: 755

Thank You
-Given: 0
-Receive: 6


View Profile WWW
« 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 Wink
« Last Edit: March 14, 2005, 11:16:59 PM by martrix » Logged

MAяTRIX

JensF
Addicted member
******
Offline Offline

Posts: 1028

Thank You
-Given: 0
-Receive: 0


View Profile WWW
« Reply #9 on: March 14, 2005, 11:18:57 PM »

Thanks, i doesn┤t read it. Now i wait.....  Rolling Eyes
Logged

Mit freundlichem Gru▀
Jens Funk



-> Sorry for my bad English <-
ascanio
Hero Member
*****
Offline Offline

Posts: 569

Thank You
-Given: 0
-Receive: 3


View Profile WWW
« 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   Crying or Very sad Crying or Very sad Crying or Very sad Confused Confused Confused Confused

Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 565

mmm PHP...


View Profile WWW
« 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)?
Logged

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)
ascanio
Hero Member
*****
Offline Offline

Posts: 569

Thank You
-Given: 0
-Receive: 3


View Profile WWW
« Reply #12 on: March 15, 2005, 05:43:06 AM »

of course  Wink I think that the ips are from spain  Embarassed 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 » Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 565

mmm PHP...


View Profile WWW
« 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... Embarassed
but I'm sure I googled them Very Happy
« Last Edit: March 15, 2005, 06:04:08 AM by V@no » Logged

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)
ascanio
Hero Member
*****
Offline Offline

Posts: 569

Thank You
-Given: 0
-Receive: 3


View Profile WWW
« Reply #14 on: March 15, 2005, 05:52:37 AM »

I just send it to you the ips in a PM Wink
Logged
Pages: [1] 2 3 4 5 6 » »» Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.112 seconds with 20 queries.
Post your comments here