Geo IP Lookup - check from which country your visitors come from Geo IP Lookup - check from which country your visitors come from
 

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]

Main Menu

Geo IP Lookup - check from which country your visitors come from

Started by Joachim Müller, May 04, 2010, 04:45:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Joachim Müller

This plugin will add a flag icon next to each IP address in the admin's backend:
  • on the banning page
  • on the review comments page
  • on the stat details page
  • on the ecard review page
  • next to each comment

The lookup will of course burn additional CPU cycles, so don\'t install this plugin it if you don\'t have the needed resources available on your server.

This can be helpfull to determine wether a user is the person he/she claims to be. If your gallery catters for a national community only, comments from someone across the globe can easily be spotted.

You have to bear in mind though that the country lookup based on IP address basis does not work reliably under all circumstances, so you should not base your entire strategy on that little piece of information. The lookup itself is being performed using the free API and database generously provided by Maxmind, which is being released under the GNU GPL.

All I did was turning this nice little lookup into a Coppermine plugin.

This plugin is using several plugin hooks that I have added only today (2010-05-04), so you can not use this plugin with coppermine versions that are older. You will need cpg1.5.4 (which has not been released yet as of today) or better, or you will need to check out cpg1.5.x from the subversion repository (you will need revision 7499 or better). You're welcome to do that and perform the checkout (refer to the documentation that comes with cpg1.5.x to figure out how to perform a checkout) and use the plugin, but please don't ask questions here to to accomplish that: that's beyond support.
If you decide to perform the checkout, you will as well have to edit one of the files that this plugin consists of: in configuration.php, the minimum requirement is defined as far as Coppermine versions are concerned. You will have to edit that setting accordingly, but keep in mind that just editing the minimum requirement setting alone won't help you in getting this plugin to work as expected: you will need the plugin hooks I refered to initially, so you will need your file revisions of coppermine's core files to be rev 7499 or better.

This plugin doesn't have any configuration section (simply because there's no need for it) nor does it feature i18n.

The plugin has been added to the subversion repository as well: http://coppermine.svn.sourceforge.net/viewvc/coppermine/branches/cpg1.5.x/plugins/geoip/ (see http://documentation.coppermine-gallery.net/en/dev_subversion.htm#dev_subversion_repository_structure_plugins)
I will probably not update this plugin frequently, so be sure to use the svn checkout.

I'd love to hear your feedback - especially a thorough benchmark would help me to decide if further improvement of the plugin is needed as far as resources consumption is concerned on busy sites. Please understand though that I'm not keen to reply to trivial question that show you haven't at least tried to read the documentation. Please do yourself and me the favor to read the relevant sections of the docs and to respect board rules before asking questions.

Joachim

Timos-Welt

Your plugin works fine for me with r7500. I'm sorry that my gallery usually has only ~10 visitors at a time, so I can't tell much about the performance impact (not notable at all on my SHP). Very good work Joachim, especially as this plugin delivers a base for a lot of things one could do with it. With some added options regarding spam protection (for example selectable from which countries comments, ecards etc are allowed), this should really go to core for 1.6.x.

jmatute

Quote from: Joachim Müller on May 04, 2010, 04:45:16 PM
This plugin will add a flag icon next to each IP address in the admin's backend:...

Wonderful!  

Is this the place to ask for a 'per city' feature request? Nearly all my visitors come from Spain, but I'd like to know about the city. I can't access Maxmind's site at work (filtered by Websense, you know), so I can't see if that's possible using that database.

Quote from: Joachim Müller on May 04, 2010, 04:45:16 PM
... You will need cpg1.5.4 (which has not been released yet as of today) or better, or you will need to check out cpg1.5.x from the subversion repository (you will need revision 7499 or better). You're welcome to do that and perform the checkout

I won't checkout new version, either. I'll wait.

Thanks.

jmatute

Quote from: Joachim Müller on May 04, 2010, 04:45:16 PM
I'd love to hear your feedback

Since I will probably use it I looked for the language files - and found none. ¿?

Quote from: Joachim Müller on May 04, 2010, 04:45:16 PM
This plugin will add a flag icon next to each IP address in the admin's backend:
  • on the banning page
  • on the review comments page
  • on the stat details page
  • on the ecard review page
  • next to each comment


Is there any chance that these statistics can be shown to all users, for instance in the gallery main page? Or it isn't this package's purpose?

Regards.

Joachim Müller

Quote from: Timos-Welt on May 05, 2010, 10:15:12 AM
Your plugin works fine for me with r7500. I'm sorry that my gallery usually has only ~10 visitors at a time, so I can't tell much about the performance impact (not notable at all on my SHP).
As this plugin currently only catters for the admin, the number of concurrent users doesn't matter too much. If you as admin don't notice a serious performance impact on pages where the plugin has got a lot of lookups to perform (e.g. on the stat_details page), then evertything should work fine.

Quote from: Timos-Welt on May 05, 2010, 10:15:12 AMVery good work Joachim, especially as this plugin delivers a base for a lot of things one could do with it. With some added options regarding spam protection (for example selectable from which countries comments, ecards etc are allowed), this should really go to core for 1.6.x.
I agree this this might go into the core at a later stage, but needs to be reviewed carefully: maxmind.com says that the FOSS plugin has got an accuracy of 99.5 % (their commercial version is meant to be 99.8 % accurate according to http://www.maxmind.com/app/geolitecountry). Applying comment sanitization based on Geo IP services can of course lead to false positives and therefore needs to be reviewed. Additionally, you lock out members of your target audience who are away on trips to countries where you wouldn't expect them to be. To actually come up with an interface for the coppermine admin that enables him to set comment approval based on IP addresses would require a lot of work. But: your suggestion definitely is worth considering.

Quote from: jmatute on May 05, 2010, 11:21:36 AMIs this the place to ask for a 'per city' feature request? Nearly all my visitors come from Spain, but I'd like to know about the city. I can't access Maxmind's site at work (filtered by Websense, you know), so I can't see if that's possible using that database.
You'd have to rewrite the plugin slightly and use another database from MaxMind (http://www.maxmind.com/app/geolitecity) that is less accurate, but it would be possible, yes.

Quote from: jmatute on May 05, 2010, 11:40:36 AM
Since I will probably use it I looked for the language files - and found none. ¿?
There is none, as I said:
Quote from: Joachim Müller on May 04, 2010, 04:45:16 PMThis plugin doesn't have any configuration section (simply because there's no need for it) nor does it feature i18n.
There is no need for a language file because the only text that comes with the plugin is the hard-coded stuff inside the file configuration.php, which is something only the admin will see once when installing. Of course, multilanguage support could be added easily. You're welcome to have a go at it - it's a good way to get a grasp of the plugin architecture to accomplish a comparatively small task.

Quote from: jmatute on May 05, 2010, 11:40:36 AMIs there any chance that these statistics can be shown to all users, for instance in the gallery main page? Or it isn't this package's purpose?
That's not the plugin's purpose: we don't display the IP addresses of our visitors publicly - that would be an invasion of privacy that I would object. Subsequently, as we nowehere display the IP addresses to the visitor, we don't display the flags neither. But of course it would be dead easy to come up with another code modification that makes the gallery display a sentence like "Hello visitor, according to the IP address lookup we just performed you appear to come from XXX". But I don't think that you should tell your users how much you could figure out about them - they'd be shy and leave your site because they're afraid you'd be spying on them.

The technology beneath the service we're using is nowadays often used by adverts from dating sites to determine from which city or region you come from and display something to you like "get in contact with XXX from YYY", where YYY is your city or a city nearby. Yes, one could come up with similar services, but I'm not going to be the person who codes this.

Joachim

phill104

Great idea this one and something that could be applied to a lot of things (dating aside). I've installed this on one of my sites and will report back in a few days once I have seen how it goes.
It is a mistake to think you can solve any major problems just with potatoes.

jmatute

Quote from: Joachim Müller on May 05, 2010, 05:47:45 PM
You'd have to rewrite the plugin slightly and use another database from MaxMind (http://www.maxmind.com/app/geolitecity) that is less accurate, but it would be possible, yes.
Given my nearly zero PHP skills  -I can hardly read it- it would be such a long task for me...

Quote from: Joachim Müller on May 05, 2010, 05:47:45 PM
You're welcome to have a go at it - it's a good way to get a grasp of the plugin architecture to accomplish a comparatively small task.
I'll try. Another task in my ToDo list.

Quote from: Joachim Müller on May 05, 2010, 05:47:45 PM
we don't display the IP addresses of our visitors publicly - that would be an invasion of privacy that I would object.
So do I. And don't know if showing an IP address would even be illegal in Spain for some csases. Just thinking about cities and not IP addresses. I'll manage with Google Analytics' info.

Quote from: Joachim Müller on May 05, 2010, 05:47:45 PM
But I don't think that you should tell your users how much you could figure out about them - they'd be shy and leave your site because they're afraid you'd be spying on them.
Not in my case, because I run a quite small CPG instance, kind of family oriented.

Thanks anyway for your comments.

Regards,
José Luis.

Joachim Müller


jmatute

Spanish file attached.

Will see the differences between versions, to learn about i18n.

Regards,
José Luis.

Joachim Müller

Quote from: jmatute on May 06, 2010, 09:20:02 AM
Will see the differences between versions, to learn about i18n.
Yes, that's the recommended method - use a tool like WinMerge to do the comparison.

Αndré


Joachim Müller

Version 1.2 of the plugin features lookup by city and has got a minimal config screen. File is attached to the initial posting; SVN repository has been updated as well. The actual GeoCity Lite database is not included into the package for space consumption reasons - you need to download it separately (instructions come with the plugin).
The city lookup doesn't work that good for the country I come from, as the major carrier in Germany bundles the IP addresses for a few cities only.  Subsequently, the lookup is more than a hundred miles off for me. This may be the case for other countries as well. I guess the lookup works best for the US.

Cheers

Joachim

jmatute

Hi,

Thanks. Spanish file attached.

Regards,
José Luis

Joachim Müller

Thanks for your contribution. I have added it and updated the zip in the first posting (v1.3).

fierarucristian

Another good IP locator and IP lookup tool is ip geolocation . Enables  you to geo locate an IP address location with ease.
The new ip geolocationip location are the world over, but only a few truly ip locator finished it to the crown.

haifa

Thanks for sharing..
I got the ip look up here http://www.ip-details.com/  and also i got the ip details,ip address,internet speed test,etc......