Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: Spuds on November 06, 2011, 02:26:09 PM

Title: geoIP (IP to Location)
Post by: Spuds on November 06, 2011, 02:26:09 PM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=3206)


geoIP Location Mod
By Spuds (http://custom.simplemachines.org/mods/index.php?action=search;author=11359)


Introduction
This modification adds the ability to determine the latitude & longitude of a member given their IP address. This is commonly referred to as geolocation.  The mod makes use of the GeoLite data created by MaxMind, available from http://www.maxmind.com/ 

In some instances the IP address will not be found in the installed database, or will have incomplete data.  In this case the mod will make use of the hostip.info site as a secondary source to gather its information.

A note on accuracy: 
Maxmind shows that this database (which is updated on a monthly basis) is over 99.5% accurate on a country level making it a viable source for registration blocking.

When it comes to the city level accuracy this number is and 79% for the US (within a 25 mile radius).  That is the best accuracy, and other countries city/region location accuracy tapper off from that.  Even with that it still makes for an entertaining online member map.

Features
o Adds the ability to block or allow member registrations on a per country basis
o Adds an on-line member map which will show a map pin for each IP currently on your forum (needs the Country & City database)
o Adds in the geoIP information under the track IP sections, allows you to see city / region (state) / country of the IP address
o Currently only for IP4 addresses

There are admin settings available with this mod, go to admin - configuration - modification settings - geoIP.

Installation
IMPORTANT NOTES:
o The package will install on all systems, however to have the mod install the maxmind geoIP databases you need to be running MYSQL.
o If you do not have the zip module installed (the mod will inform you of this) then you may run into an out of memory issue when unzipping the large database. Without the zip module the memory requirements are 272M which may be a problem on some systems.  If you get an out of memory error or white screen your options are to use the country only database or to use the manual install option which requires that you upload the unzipped CSV files and then mod will install them.
o Often the maxmind download site is very slow, as such some sites may timeout when downloading the database files.  The mod does request more time but some hosts still do not allow this.  If you time out, simply try again at another time.
o The mySQL database size for the full country city database table will be approximately 80M, if storage space is an issue on your host / server please keep this in mind.

This mod is compatible with SMF 2.0 Only.

Support
Please use the geoIP modification thread for support with this modification.

Changelog
1.1.2 - 26 Apr 2013
! fixed problem due to  maxmind moving the csv download location for the city/county csv  only !
! fixed issue with large query on some sites thanks Joker
! minor format and unnecessarily global removal
! you can update by simply copying the geoIP.php and geoIPAdmin.php files to your sources directory

1.1.1 - 23 Jan 2012
! fixed error with county only database and Invalid Value Sent to Database error
! fixed issue with external lookups parsing

1.1 - 08 Dec 2011
+ Country flags next to member names in whos online list
+ Membergroup permissions for IDing member pin on online map (was on/off for all)
+ Improved logic for geoIP lookups
+ Released under BSD license
+ Stores geo data as part of the online table when the user lands instead of as on-demand data.

1.0 - 07 Sep 2011
+ Initial Release
Title: Re: geoIP (IP to Location)
Post by: Bugo on November 07, 2011, 11:39:52 AM
Well, I just started to translate this mod but found a hardcoded text in geoIP.template.php:
Code: [Select]
Last Update Status: Did you left it specially for translators? :)
Title: Re: geoIP (IP to Location)
Post by: Spuds on November 07, 2011, 12:21:37 PM
Well, I just started to translate this mod but found a hardcoded text in geoIP.template.php:
Code: [Select]
Last Update Status: Did you left it specially for translators? :)
Doh! .... thanks for finding that, I hope its the only one you find!  Good old hard coded text always seems to find its way in .... I put a new package with that changed to a txt string on the site :)
Title: Re: geoIP (IP to Location)
Post by: vbgamer45 on November 07, 2011, 01:17:28 PM
Very nice mod glad it was made. Helpful to see what IP a country is from and "Adds the ability to block or allow member registrations on a per country basis"
Title: Re: geoIP (IP to Location)
Post by: 4Kstore on November 07, 2011, 01:25:48 PM
I need something like this !
Thanks!
Title: Re: geoIP (IP to Location)
Post by: Adrek on November 07, 2011, 01:57:48 PM
Interesting, this mod shows that I'm somewhere in middle of the Atlantic :D

anyway, nice mod ;)
Title: Re: geoIP (IP to Location)
Post by: Manu.G on November 08, 2011, 12:52:33 PM
Great mod, exactly what I was searching for.

Only one question.
Is it possible to hide the online map for guests?
Title: Re: geoIP (IP to Location)
Post by: Spuds on November 08, 2011, 04:29:05 PM
Great mod, exactly what I was searching for.

Only one question.
Is it possible to hide the online map for guests?
You should be able to go to admin -> members -> permissions -> general permissions and select guest ... then under guest make sure that View Who's Online Map is not checked
Title: Re: geoIP (IP to Location)
Post by: Manu.G on November 08, 2011, 04:53:42 PM
The permission settings I haven't seen, sorry.
I checked it and for guests the permission isn't given, but when I'm as guest on my forum
I can still enter the map :-?

I think something went wrong when I installed it. I got an error-message it was for the Who.template.php,
could it be because of this the mod wasn't installed correct?
Title: Re: geoIP (IP to Location)
Post by: Spuds on November 08, 2011, 06:48:58 PM
The permission settings I haven't seen, sorry.
I checked it and for guests the permission isn't given, but when I'm as guest on my forum
I can still enter the map :-?

I think something went wrong when I installed it. I got an error-message it was for the Who.template.php,
could it be because of this the mod wasn't installed correct?
Probably means you had guests allowed to view who's online enabled as well.  I had the mod set up based on either permissions which is confusing so I've changed it to behave more in line with the permissions and not as a hierarchy of them, they will now need both now to view the map.  Permissions are confusing enough without my help  :P

You can just copy the below file over the one in your sources directory instead of uninstalling and reinstalling the mod.

regarding the who online template error, that would just prevent the view the online map link from showing on the whos online page, nothing to worry about really.
Title: Re: geoIP (IP to Location)
Post by: Manu.G on November 08, 2011, 07:06:50 PM
Thanks a lot! It works!

Ah now I got it :)
Yes, guest have the permission to see "Who's online". Now my English is leaving me, but I think I got
what the problem is. :)
Title: Re: geoIP (IP to Location)
Post by: Manu.G on November 09, 2011, 02:56:28 AM
Me again  :-[


In the forum I'm running we used the last years the Location Mod by Gobalopper
http://custom.simplemachines.org/mods/index.php?mod=56 (http://custom.simplemachines.org/mods/index.php?mod=56)
With this mod was it possible to show in the "Who's Online" list a little flag in front of
the name of the member and guest. It was a nice extra feature.


Is it possible to add this to the who's online list? Just the flag of the country nothing more.
It won't be a problem when guests can see from which country a member/visitor is coming,
without telling the city as it is in the the GeoIp online map.


Only when it isn't for need to make some huge changes :)
Title: Re: geoIP (IP to Location)
Post by: Spuds on November 15, 2011, 10:39:33 PM
Here is an early preview of version 1.1

It adds the flags next to the member names in the online map and fixes/improves various other things in the mod.  This one is for testing and feedback  ;)
Title: Re: geoIP (IP to Location)
Post by: Manu.G on November 16, 2011, 11:10:30 AM
Hey, that's great! Thanks!


I installed it on my test forum and here is what happen :)


I marked in the GeIP settings "Enable the GeoIP Who's online flags:" but after I saved the settings,
it's unchecked. It only appears as marked when all boxes are checked. So I marked all 4 boxes, saved and
removed 2 marks "Enable the GeoIP Registration Filter:" and "Enable the GeoIP Pin identification:" saved and
after this "Enable the GeoIP Who's online flags:" was also unchecked.


The flags in the "Who's online" working perfect for members I think, but not for guests.
In front of my member name the little flag appears, the correct flag, but not by guests.
In front of a guest is a little field to see, but no flag, because it should be this flag
".../Themes/default/images/ISO_3166_Flags/.gif"


Could be something went wrong during the install but the only test failed message I got was the Who.template.php, the
code for it I installed manual


But despite everything, it's great to get the little flags back in the "Who's online" :D
Title: Re: geoIP (IP to Location)
Post by: Spuds on November 16, 2011, 01:27:29 PM
Quote
I marked in the GeIP settings "Enable the GeoIP Who's online flags:" but after I saved the settings,
it's unchecked.
That was a typo on my part ... I updated the package in the above post so that should be fixed.

I was not able to reproduce the guest item you were describing.   Its important to note that if members or guests were online when the mod was installed, it will not update them right away (it will for anyone who logs in after its installed but may take sometime to refresh for those that were on-line already) It really only checks when a user first goes to the site to minimize overhead.

In those cases you would just get the [*] symbol for the flag.  I've changed that to be a pirate flag instead :P

Title: Re: geoIP (IP to Location)
Post by: Manu.G on November 16, 2011, 01:55:10 PM
Quote
I marked in the GeIP settings "Enable the GeoIP Who's online flags:" but after I saved the settings,
it's unchecked.
That was a typo on my part ... I updated the package in the above post so that should be fixed.

I was not able to reproduce the guest item you were describing.   Its important to note that if members or guests were online when the mod was installed, it will not update them right away (it will for anyone who logs in after its installed but may take sometime to refresh for those that were on-line already) It really only checks when a user first goes to the site to minimize overhead.

In those cases you would just get the [*] symbol for the flag.  I've changed that to be a pirate flag instead :P

Works like a charm! You are GREAT!!!
The pirate flag is a great idea!!!  O:)


Found an entry in the error-log, but I saw it few days ago in the actual forum, but forget to tell you  :-[


Quote
8: Undefined index: cannot_geoIP_view
File: .../.../www/.../.../Sources/Security.php
Line: 894
The error was caused by a guest :)
Title: Re: geoIP (IP to Location)
Post by: Fed Drago on December 14, 2011, 08:28:31 AM
Hello I love this Mod but when I try to Backup my database using the back up section in Smf I get a white screen and nothing happens. I uninstalled this mod and ran the back up database again and everything worked?

Is this a bug or Have I missed something?

Cheers
Title: Re: geoIP (IP to Location)
Post by: Spuds on December 14, 2011, 09:42:29 AM
I'll check on that but my initial guess is that since the database is large (the full geoip table is about 80m) that you are simply running out of memory during the SMF database backup which results in a white screen.  If you have access to phpmyadmin you can backup from there and just not select that table when you export.   

FYI thats not normally going to be the largest table in SMF but if the forum is new or does not have a lot of messages yet then it could be.  On my site the message and search tables dominate in the size race.
Title: Re: geoIP (IP to Location)
Post by: Fed Drago on December 14, 2011, 04:45:42 PM
I'll check on that but my initial guess is that since the database is large (the full geoip table is about 80m) that you are simply running out of memory during the SMF database backup which results in a white screen.  If you have access to phpmyadmin you can backup from there and just not select that table when you export.   

FYI thats not normally going to be the largest table in SMF but if the forum is new or does not have a lot of messages yet then it could be.  On my site the message and search tables dominate in the size race.

Yes I figured as much, I do not have any problem backing up my database from my server at all. Its only why I back up the data base from the forums maintenance in the Admin section. It's just convenient to use instead of logging into my server.

If you find anything please let me know. 

Also yes I only have around 200 messages on my forums so it is very small.

Thank you  :) 
Title: Re: geoIP (IP to Location)
Post by: Jeff B on December 17, 2011, 12:09:40 PM
I was looking forward to giving this a try, and it installed, according to the package manager without error.  I can not find any sign of the configuration link in the admin section, so I decided to try to uninstall, and the following is what I see. Does this mean it did not actually install?

1.    Execute Code    add_remove_hooks.php    
   2.    Delete File    ./Sources/geoIPIntegration.php    
   3.    Delete File    ./Sources/geoIP.php    
   4.    Delete File    ./Sources/geoIPAdmin.php    
   5.    Delete File    ./Themes/default/css/geoIP.css    
   6.    Delete File    ./Themes/default/scripts/geoIP_database.js    
   7.    Delete File    ./Themes/default/geoIP.template.php    
   8.    Delete File    ./Themes/default/languages/geoIP.english.php    
   9.    Delete File    ./Themes/default/languages/geoIP.english-utf8.php    
   10.    Delete File    ./Themes/default/images/admin/geoip.gif    
   11.    Delete Tree    ./Themes/default/images/ISO_3166_Flags    
   12.    Delete Tree    ./Sources/geoIP    
*    13.    Execute Modification    ./Sources/Register.php    Test failed
      1.    Replace    ./Sources/Register.php    Test failed
*    14.    Execute Modification    ./Themes/default/BoardIndex.template.php    Test successful
*    15.    Execute Modification    ./Sources/Who.php    Test failed
      1.    Replace    ./Sources/Who.php    Test failed
      2.    Replace    ./Sources/Who.php    Test failed
*    16.    Execute Modification    ./Themes/default/Who.template.php    Test failed
      1.    Replace    ./Themes/default/Who.template.php    Test failed
      2.    Replace    ./Themes/default/Who.template.php    Test failed
      3.    Replace    ./Themes/default/Who.template.php    Test failed
*    17.    Execute Modification    ./Sources/Profile-View.php    Test failed
      1.    Replace    ./Sources/Profile-View.php    Test failed
*    18.    Execute Modification    ./Themes/default/Profile.template.php    Test failed
      1.    Replace    ./Themes/default/Profile.template.php    Test failed
*    19.    Execute Modification    ./Sources/ScheduledTasks.php    Test failed
      1.    Add Before    ./Sources/ScheduledTasks.php    Test failed
*    20.    Execute Modification    ./Sources/Subs.php    Test failed
      1.    Replace    ./Sources/Subs.php    Test failed
*    21.    Execute Modification    ./Themes/default/languages/Modifications.english.php    Test failed
      1.    Add Before    ./Themes/default/languages/Modifications.english.php    Test failed
*    22.    Execute Modification    ./Themes/default/languages/Who.english.php    Test failed
      1.    Replace    ./Themes/default/languages/Who.english.php    Test failed
   23.    Execute Modification    ./Themes/default/languages/Modifications.english-utf8.php    Skipping file
   24.    Execute Modification    ./Themes/default/languages/Who.english-utf8.php    Skipping file
   25.    Adapt Database    remove_settings.php    
Title: Re: geoIP (IP to Location)
Post by: Spuds on December 17, 2011, 12:20:30 PM
Thats what that looks like to me ... not sure why it would have not given you an error during install though, there are a couple of "skip on error" edits for the non-vital areas but not all those .....  If you attach your Register.php I'll take a quick look to see if the edits are in there or not ...
Title: Re: geoIP (IP to Location)
Post by: Jeff B on December 17, 2011, 12:49:51 PM
Okay, attached.   I do not see any additional files in sources either related to the mod, but there are tables created in the database.
Title: Re: geoIP (IP to Location)
Post by: Spuds on December 17, 2011, 04:24:09 PM
No trace of the mod in that file ....

My only thought is that since it did the install tables, is that there was some form of an error during that table creation process so it failed to do the remainder of the edits and file copys.  I did notice one minor thing in the add_settings.php file that may have caused an issue, and I added in a server timeout prevention in case it was that, and re-submitted the package. 

Before I did that I tried it as it was on 3 different servers without issue so the above is just a shot in the dark ... when you installed it did you get a white screen or did everything appear to go normally?  Are you restricted in how much memory you can get on your system?
Title: Re: geoIP (IP to Location)
Post by: Jeff B on December 17, 2011, 05:16:40 PM
No white screen.  The only thing I had to do, which I have had to do before with certain mods, is create a temp file in the package directory and set permissions on that. Once I did, it looked like a normal install.  The tables in the database are there, but appear to be empty.  I'm not sure how to know about the memory restrictions question, but this is a dedicated server.
Title: Re: geoIP (IP to Location)
Post by: Jeff B on December 18, 2011, 12:26:26 PM
Apparently, the mod was selective on what it touched. I was looking at schedualed tasks, and there at the bottom was a geo task.   Not sure what to do about this at this point. Perhaps go through each file and try to manually complete the mod? 
Title: Re: geoIP (IP to Location)
Post by: Spuds on December 18, 2011, 02:35:01 PM
On a dedicated server you should not have a memory issue, I just asked as on some hosts folks get limited to say 64M max and when you are dealing with a large amount of data as this mod does during install and more so during setup, well 64M will not cut it.

Anyway back to your issue.  Several of the tables will be blank until the mod is installed and the main database is downloaded and installed.   You should have several geoip_XYZ tables, only two of them should have data initially, those are the geoip_countries and geoip_regions tables, the others will be populated after you are able to run the mod and install the main database.

The only way that I can think of that would have allowed it to selectively installed things is if it did not have write permissions to the files that it need to modify.    Really strange about the schedule task since the uninstall log you provided has a fail on it for that file for uninstall which just seems extra odd.

You could certainly try to manually install the mod, there are several files to edit and quite a few files to copy to various areas (scripts, templates, sources, languages, etc).  I can only think that the installer hit some permissions problem and either did not create the sub directories in the package or did not have write permissions to the source files, or both.


Title: Re: geoIP (IP to Location)
Post by: Jeff B on December 18, 2011, 10:32:01 PM
Seems like I'm kinda in a pickle either way. I either have to go through files and remove information, or go through files and add info.  Any thoughts on what might be the best way to proceed?
Title: Re: geoIP (IP to Location)
Post by: Spuds on December 18, 2011, 10:49:32 PM
IMO, if this is your live site I'd let the package manager uninstall the mod and ignore the errors which all appear to be because the changes were never made in the first place.   You can double check that the edits / files / tables are gone (be sure to select the remove data checkbox during the uninstall to get the tables as well). 

There are a few known issues with the package manager that are being worked on, it shows up with certain server configs and package configs and thats appears to be what we have here  :-[

If for some reason things go 'bad' I'll be glad to help you out
Title: Re: geoIP (IP to Location)
Post by: Jeff B on December 18, 2011, 10:56:08 PM
Okay, thank you. I'll wait until maybe tomorrow night last when I have some time and back everything up, and give that a try.

I'd rather you had said the opposite, because the mod looked like it would have been pretty helpful. ;D
Title: Re: geoIP (IP to Location)
Post by: Fed Drago on December 19, 2011, 02:31:40 PM
I'll check on that but my initial guess is that since the database is large (the full geoip table is about 80m) that you are simply running out of memory during the SMF database backup which results in a white screen.  If you have access to phpmyadmin you can backup from there and just not select that table when you export.   

FYI thats not normally going to be the largest table in SMF but if the forum is new or does not have a lot of messages yet then it could be.  On my site the message and search tables dominate in the size race.

Yes I figured as much, I do not have any problem backing up my database from my server at all. Its only why I back up the data base from the forums maintenance in the Admin section. It's just convenient to use instead of logging into my server.

If you find anything please let me know. 

Also yes I only have around 200 messages on my forums so it is very small.

Thank you  :)

So have we looked into this a bit more. As I like backing by database from the admin of SMF. I do not always have access to my server to do the back up.
Title: Re: geoIP (IP to Location)
Post by: Fed Drago on December 26, 2011, 03:28:55 PM
I will keep my eyes open for an answer to my question regarding Data Base back up see my previous message above. I love this Mod but the Databases either have to execute faster with less memory load. I have uninstalled this mod for now ans also had to drop files from the Database as the uninstall feature does not do this automatically for you.

Thank you

Title: geoIP (IP to Location): Problems with database
Post by: Monzetti on January 20, 2012, 06:26:37 AM
Hi to everybody in here :)

i am very interested to this mod - downloaded it an try to install...

Like every time while installing mods, it will not work automatically, but in the past I was every time able to do the manually steps up to victory ;)

But not in this case...

I got all installation steps manually and now I´m at the point, every php works and looks ok...

On the administration - configuration - geoIP - screen we´re at the point to install the database - and now I have no idea anymore...

There are 3 options avaible: Complete, only countries or manual

For the first both options I always - at different times a day - there is the message, download of the database at maxmind aborted...

For the third option I manually downloaded both packages - country&location and only country. I unzipped them locally and uploaded them (one time the to csv-files oft the big package, the other time the csv-file of the small package) to the /Sources/geoIP ...

Now I selected the "manual-option" and now every time there ist an error message: Database Import Error

To my installation: SMF 2.0.2 on a Linux server, mySQL-Database...

What ist wrong?

thx for any help,

Monzetti

P.S.: perhaps I have to drop all geoIP-tables in the database and start new? I don´t know what I can try now to get mod running... :(( Is there a script to get geoIP db-tables fresh and correct after dropping the tables?
Title: Re: geoIP (IP to Location)
Post by: sd17 on January 20, 2012, 02:28:43 PM
I installed geoip mod and once i logged out as admin, i started getting the error message

"Wrong Value type sent to the database. Floating point number expected (latitude)"

Initially I tried deleting the mod but was not successful and the entire database crashed. Again I re-installed SMF and installed Geoip mod again.

Again the same problem is repeated.

My site url is anydoubt.in

Pls suggest how to delete the mod through cpanel as I am not able to login to the admin section to disable the mod
Title: Re: geoIP (IP to Location)
Post by: Monzetti on January 20, 2012, 03:57:56 PM
Me again...

two times deinstallation geoIP, two times new installation, every time at the same point...

......./forum/index.php?action=admin;area=geoIP;sa=main

// geoIP menu tabs $txt['geoIP'] = 'Geo-IP'; $txt['geoIPMap'] = 'Map Settings'; $txt['geoIPMain'] = 'Geo-IP'; $txt['geoIPSettings'] = 'Registration Settings'; $txt['geoIPOnlineMap'] = 'Online Member Map'; $txt['geoIP_info'] = 'GeoIP information for IP'; $txt['permissionname_geoIP_view'] = 'View Who\'s Online Map'; $txt['permissionhelp_geoIP_view'] = 'Allow the members to view the geoIP Whos Online Map. If not set, these members will not see the map.'; $txt['permissionname_geoIP_viewdetail'] = 'Identify Pin owner in the Online Map'; $txt['permissionhelp_geoIP_viewdetail'] = 'Allow the members to view which member a pin belongs to on the geoIP Whos Online Map. If not set, these members will not see the pin details.'; $txt['scheduled_task_desc_geoIP'] = 'Attempts to retrieve and install the latest database (of the type you installed) from Maxmind'; $txt['scheduled_task_geoIP'] = 'geoIP Database Update'; $txt['cannot_geoIP_view'] = 'Sorry, you are not allowed to view the Whos Online Map.';
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 25167285 bytes) in /var/www/vhosts/lentz-chronik.de/httpdocs/forum/Sources/geoIPAdmin.php on line 1007

...and afterwards on every page in SMF 2.0.2 this text comes up - puhhh - then deinstallation again :( ... poor.... can´t install the mod correctly...

Bye,

Monzetti
Title: Re: geoIP (IP to Location)
Post by: Spuds on January 20, 2012, 04:43:29 PM
Quote
For the first both options I always - at different times a day - there is the message, download of the database at maxmind aborted...
Not sure where that error is comming from, the mod will say "Error during the downloading of the zip file from MaxMind" but either way its indicating that php or the connection to maxmind is timing out before the download can be completed.  You can try to increase the max_execution_time allowed in your php.ini if you host allows for that.

For the manual install you can try to truncate (empty) the geoip_ip and geoip_blocks if you are doing the Complete install, and if country only the you only need to do that to the geoip_ip table to see if that helps.  The database import error says that mySQL is unable to import the csv datafile which is not a great help, its simply letting you know where it failed.

Quote
Fatal error: Allowed memory size of 33554432 bytes exhausted (
Your site is simply not going to be able to support this mod if you are being restricted to 32M from your host.
Title: Re: geoIP (IP to Location)
Post by: Spuds on January 20, 2012, 04:46:25 PM
Quote
"Wrong Value type sent to the database. Floating point number expected (latitude)"
Do you have a line number where that error is getting exposed? 
Which database did you install, full or country only?
Map activated?
Registration filters activated?

Need some more information so I can try to understand why its throwing that error.
Title: Re: geoIP (IP to Location)
Post by: Gorion on January 23, 2012, 07:58:17 AM
I have exactly the same issue with the
Quote
Wrong value type sent to the database. Floating point number expected. (latitude)
There is no info where the problem is, like line etc. See attached image.
I can't log in into admin. How can I remove or correct it?
Title: Re: geoIP (IP to Location)
Post by: Spuds on January 23, 2012, 02:13:44 PM
I'll need CP access to your site so I can figure out why its doing that .... I have not been able to duplicate the error on my sites so not sure why its doing that.   If you allow me access then PM me the login details.

Thanks

ETA: I think I have found the issue, seems to come from the use of the country only database, I hope thats what everyone that has seen this problem is using!  Please try the attached file, just overwrite the one by the same name in the sources directory
Title: Re: geoIP (IP to Location)
Post by: Gorion on January 24, 2012, 05:34:52 AM
Thanks that worked.
Title: Re: geoIP (IP to Location)
Post by: Monzetti on January 24, 2012, 09:58:36 AM
Quote
Fatal error: Allowed memory size of 33554432 bytes exhausted (
Your site is simply not going to be able to support this mod if you are being restricted to 32M from your host.

Hi, - me again :)

now I´ve new information: My WebSpace will move to a new server with 128 MB memory... Will this work with geoIP?

Greetings,

Monzetti
Title: Re: geoIP (IP to Location)
Post by: Monzetti on February 02, 2012, 09:22:50 PM
And me again,

ok - my domain is now on the new server, but the installation of geoIP was with same result like in the past...

Then I tried to install the mod, so the db-tables will be in database. Then i downloaded the zip-file from maxmind and import the zip file about myphpadmin in the geoIP_temp - table (because there was the same table structure). Afterwards i dropped the geoIP-Table and copied the geoIP_temp to geoIP --> that worked ;)

SMF 2.0.2 has now the geoIP configuration zone - and that php say: The Database is installed with 158,624 IP ranges

I hope, that´s fine??

One Problem: On every page I have now text at the top, - over the forum logo:

/ geoIP menu tabs $txt['geoIP'] = 'Geo-IP'; $txt['geoIPMap'] = 'Map Settings'; $txt['geoIPMain'] = 'Geo-IP'; $txt['geoIPSettings'] = 'Registration Settings'; $txt['geoIPOnlineMap'] = 'Online Member Map'; $txt['geoIP_info'] = 'GeoIP information for IP'; $txt['permissionname_geoIP_view'] = 'View Who\'s Online Map'; $txt['permissionhelp_geoIP_view'] = 'Allow the members to view the geoIP Whos Online Map. If not set, these members will not see the map.'; $txt['permissionname_geoIP_viewdetail'] = 'Identify Pin owner in the Online Map'; $txt['permissionhelp_geoIP_viewdetail'] = 'Allow the members to view which member a pin belongs to on the geoIP Whos Online Map. If not set, these members will not see the pin details.'; $txt['scheduled_task_desc_geoIP'] = 'Attempts to retrieve and install the latest database (of the type you installed) from Maxmind'; $txt['scheduled_task_geoIP'] = 'geoIP Database Update'; $txt['cannot_geoIP_view'] = 'Sorry, you are not allowed to view the Whos Online Map.';

It seems, there ist any php-file not ok? Don´t know, where to find this. And where should be the map with the flags?

Is there any forum to have a look on geoIP working? Would be fine to see the finish :)

Sorry for my poor english language, but i hope you see, that I´m working hard to get geoIP running...

Please help :D

Monzetti
(www.lentz-chronik.de/forum)
Title: Re: geoIP (IP to Location)
Post by: Monzetti on February 03, 2012, 03:33:29 AM
Yes, it´s me :)

Found it...

The text at the top of every page was in the Modifications.german-utf8.php...

deleting it in this file fixed it - it´s now only in the Modifications.english-utf8.php...

But there is no map, no flags, nothing...

I only see the pirate-flag in the "Who´s online"....

And at tracking page a lot of entries:    
8: Undefined index: geoIP
?action=profile;area=tracking;sa=ip;searchip=217.229.145.130;u=3

Monzetti
Title: Re: geoIP (IP to Location)
Post by: Spuds on February 03, 2012, 10:51:30 AM
Send me a PM with an FTP account to your site so I can take a look at the files that have been edited and make sure they are correct.  Normally I'd tell you to attach them here but there are quite a few that are changed.

Also you have installed the country only database, which is fine, however the map is not available with that database.  This is because that database only resolves down to a country level, so it would know someone was from Germany but not where in Germany (meaning all online members from Germany would have the same map location).

Title: Re: geoIP (IP to Location)
Post by: Monzetti on February 03, 2012, 01:55:49 PM
Done - you´ve the PM...

Yes, but I want all the features of geoIP ;) - with map and pins and everything the mod is able to deliver...

I think the files are ok so far, because I checked them today in the morning...

The point is the database - How I can install the both big tables for full installation? The error message ist so small, so I´m not able to tell something intelligent to the ISP Service People...

Perhaps you will find the right path to victory :D

Greetings,

Monzetti
Title: Re: geoIP (IP to Location)
Post by: FireDitto on February 16, 2012, 03:47:26 AM
=/ All my flags appear to be skulls and cross bones?
Title: Re: geoIP (IP to Location)
Post by: Spuds on February 16, 2012, 02:17:40 PM
It will do that when you first install the mod for any users who were already online, that will clear itself as members log in/out etc.

If you are getting that all the time, then it would indicate the database did not install correctly and its not getting a result back so it shows the unknown flag.
Title: Re: geoIP (IP to Location)
Post by: FireDitto on February 18, 2012, 05:14:32 AM
Ah, yes. It's all cleared up now :D

Very spiffy mod. Thanks!
Title: Re: geoIP (IP to Location)
Post by: sususmo on March 05, 2012, 03:43:26 AM
Interesting, this mod shows that I'm somewhere in middle of the Atlantic :D

anyway, nice mod ;)


I too show up in the middle of the atlantic with many others. :(
Title: Re: geoIP (IP to Location)
Post by: NDFF on March 09, 2012, 02:40:18 PM
With SMF 2.0.2, I get the following error
Column count doesn't match value count at row 1
Sources/Subs.php
Line: 2704

And the line is
Code: [Select]
                        $smcFunc['db_insert']($do_delete ? 'ignore' : 'replace',
                                '{db_prefix}log_online',
                                array('session' => 'string', 'id_member' => 'int', 'id_spider' => 'int', 'log_time' => 'int', 'ip' => 'raw', 'url' => 'string', 'latitude' => 'float', 'longitude' => 'float', 'country' => 'string', 'city' => 'string', 'cc' => 'string'),
                                array($session_id, $user_info['id'], empty($_SESSION['id_robot']) ? 0 : $_SESSION['id_robot'], time(), 'IFNULL(INET_ATON(\'' . $user_info['ip'] . '\'), 0)', $serialized, $geoIP[0]['latitude'], $geoIP[0]['longitude'], $geoIP[0]['country'], $geoIP[0]['city'], $geoIP[0]['cc']),
                                array('session')
                );

What is wrong with this and how do I get rid of this error.
Title: Re: geoIP (IP to Location)
Post by: Spuds on March 09, 2012, 10:17:13 PM
It might mean your log_online table was not updated properly ... if you manually installed the mod you need to add the needed cols to the log_online table (as defined in the add_settings.php file in the package)
Title: Re: geoIP (IP to Location)
Post by: NDFF on March 12, 2012, 04:02:44 PM
Structure of log_online. The columns are there?
Title: Re: geoIP (IP to Location)
Post by: Kein Name on March 12, 2012, 04:16:24 PM
Using smf vers 2.0.2 and not able to load the db, copied the csv file to sources/geoIP and choose manual and got: The Database is not installed
Last Update Status: Database Import Error

Any help ?

TIA
Title: Re: geoIP (IP to Location)
Post by: rolltidega on March 18, 2012, 11:10:38 PM
Just to clarify... this mod is used to ONLY block someone from accessing the registration page correct?  If a valid user that logs in from a blocked country tries to log in and access the site, that user WILL BE ALLOWED, right?  ONLY new registrations are disallowed with the mod, right?  Please let me know....
Title: Re: geoIP (IP to Location)
Post by: Spuds on March 19, 2012, 09:44:29 AM
Correct ... the blocking part of the mod is only a registration block.  If they have a valid account they would be unaffected.  You could mod it to do more should you like.
Title: Re: geoIP (IP to Location)
Post by: Kein Name on March 19, 2012, 10:50:00 AM
It would have been nice if I wold have received a reply to my question as well, but looks like not everybody gets on. Kann was ......
Title: Re: geoIP (IP to Location)
Post by: rolltidega on March 19, 2012, 02:33:06 PM
Thanks for the answer Spuds.  Are blocked registrations logged somewhere???
Title: Re: geoIP (IP to Location)
Post by: ChaosEnergy on April 15, 2012, 06:41:46 PM
hi
installed this mod without any errors on 2.02

clicked update database for citry+country, something like a downloadbar appeared for a short moment and then i get

The Database is not installed
Last Update Status: Unable to determine the latest CSV file from MaxMind

what can i do, to get it working?
Title: Re: geoIP (IP to Location)
Post by: Kein Name on April 16, 2012, 03:05:18 PM
@ChaosEnergy

I got the same problem, as you can see in my post above. But the developer of this mod does not find it necessary to answer such questions. Its a so called well supported mod :(
Title: Re: geoIP (IP to Location)
Post by: Manu.G on May 11, 2012, 03:18:40 PM
I've the same problem with the update of the database. :(

Isn't it possible to get some help for it? Woudl be great :)
Title: Re: geoIP (IP to Location)
Post by: Buta on June 12, 2012, 09:34:21 AM
I've the same problem with the update of the database.

Title: Re: geoIP (IP to Location)
Post by: cyberjunkie on June 18, 2012, 03:12:28 PM
I have 3 errors

The Database is not installed
Last Update Status: The MaxMind download site did not respond

This was voor de country and city csv


The Database is not installed
Last Update Status: Error during the downloading of the zip file from MaxMind

This was for the Country only


The Database is not installed
Last Update Status: Unable to find unzipped files

And this one was for the manual install.

The csv file.s are in the directory  Sources/geoIP/


Title: Re: geoIP (IP to Location)
Post by: koop on October 15, 2012, 11:46:30 PM
I just installed geoip, installed the full database option and then enabled the options.  I'm now getting the following error on my site and have lost all functionality. 

The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
File: /hermes/waloraweb082/b2083/moo.thebigtenhangoutcom/forum/Sources/geoIP.php
Line: 586

Any ideas?  I cannot find "Max_join_size" in my php.ini file. 
Title: Re: geoIP (IP to Location)
Post by: Arantor on October 16, 2012, 09:55:49 AM
You won't find it in php.ini, because it's not a PHP option. It's an SQL configuration option in MySQL - and on shared hosting you're just not going to be able to change that.

I'd love to know what's on lines 576-586 of geoIP.php.
Title: Re: geoIP (IP to Location)
Post by: Leo2 on October 22, 2012, 03:33:16 AM
I have same MAX_JOIN_SIZE error after my hoster made some 'upgrade' in their database.

My forum didn't work until I removed older Geoip version ( I had to comment call to it in subs.php because admin pages didn't work either). After installing the newer version, the forum works, but shows same error in user profile.

Lines 568-586 are:

Code: [Select]
if (strpos($ip,'.'))
$ip = geo_dot2long($ip);

$request = $smcFunc['db_query']('', '
SELECT ip.start, ip.end,
bl.city, bl.latitude, bl.longitude,
gc.cc, gc.cn as country,
gr.rn as region
FROM {db_prefix}geoip_ip as ip
LEFT JOIN {db_prefix}geoip_blocks AS bl ON (ip.locid = bl.locid)
LEFT JOIN {db_prefix}geoip_countries AS gc ON (gc.cc = bl.country)
LEFT JOIN {db_prefix}geoip_regions AS gr ON (gr.rc = bl.region && gr.cc = bl.country)
WHERE ip.end >= {int:ip}
ORDER BY ip.end ASC
LIMIT 1',
array(
'ip' => (int) $ip
)
);
Title: Re: geoIP (IP to Location)
Post by: Joker™ on October 22, 2012, 08:25:41 AM
I have same MAX_JOIN_SIZE error after my hoster made some 'upgrade' in their database.

My forum didn't work until I removed older Geoip version ( I had to comment call to it in subs.php because admin pages didn't work either). After installing the newer version, the forum works, but shows same error in user profile.
A user has faced similar issue. Try reading out the topic (http://www.simplemachines.org/community/index.php?topic=488432.0).
Title: Re: geoIP (IP to Location)
Post by: Leo2 on October 24, 2012, 05:31:20 AM
A user has faced similar issue. Try reading out the topic (http://www.simplemachines.org/community/index.php?topic=488432.0).
Thank you! That helped me too.
However, I face another problem with online users counter (http://www.simplemachines.org/community/index.php?topic=488842.0), making geoip useless. May be you know the fix for that too?
Title: Re: geoIP (IP to Location)
Post by: Ice_Drake on October 31, 2012, 08:07:44 PM
Hi, I am having trouble installing the MaxMind CountryLite database. I tried installing it with the script, but it said Database Import Error. Then I tried installing it manually, but it always fails with the following error for two of the five tables:

Invalid column count in CSV input on line 1.

For those who has success installing the database, may you attach the mySQL file for those tables?
Title: Re: geoIP (IP to Location)
Post by: musicus on November 18, 2012, 07:35:03 PM
I think I can report a new bug.
The addon has worked for about 6 months without any problems. Then I realized that at once is no new user more signed up. I've tried I then times as a new user to log on again. Then came the message: "error: registration disabled".
After I the addon was uninstalled, the registry went again.
Since our Forum has an international audience, I found very handy to see it, where the users are coming
Sorry, for my bad English
Title: Re: geoIP (IP to Location)
Post by: bgandy on November 26, 2012, 03:27:57 PM
Is this mod still supported?

I installed on my site, but no one can see it. Not even the admin account. I have the mod enabled in settings and I have added permission for the groups allowed access.
Title: Re: geoIP (IP to Location)
Post by: Qayyom Ashraf on December 05, 2012, 12:54:54 AM
I tried to search Coutry & City database menually but did't find from the mentioned site.

Please give me the complete URL of downloadable database

Regards,
Title: Re: geoIP (IP to Location)
Post by: Hristo on December 05, 2012, 01:35:28 AM
If you mean the MaxMind databases, here they are (the free ones):
http://dev.maxmind.com/geoip/geolite
Title: Re: geoIP (IP to Location)
Post by: cyberjunkie on February 15, 2013, 01:59:21 PM
I have 3 errors

The Database is not installed
Last Update Status: The MaxMind download site did not respond

This was voor de country and city csv


The Database is not installed
Last Update Status: Error during the downloading of the zip file from MaxMind

This was for the Country only


The Database is not installed
Last Update Status: Unable to find unzipped files

And this one was for the manual install.

The csv file.s are in the directory  Sources/geoIP/

Is here any support?
Title: Re: geoIP (IP to Location)
Post by: SugarD-x on May 28, 2013, 10:22:50 AM
I'm getting similar issues. Due to my crappy free host for this site I'm developing on, I can't download via the Country/City option successfully. Country partially works, as it grabs the file and begins to unzip, but it never finishes, so the file is corrupt. If I try to import the unzipped files manually from MaxMind's site, it just gives me the usual "Database Import Error". I'm completely out of ideas here.
Title: Re: geoIP (IP to Location)
Post by: Spuds on May 28, 2013, 11:40:25 AM
I made a couple of minor updates on the github repo here: https://github.com/Spuds/GeoIP

Maxmind had moved the location of the larger country/city files and a tweak that will help with some instances of mysql during the import (I think it was just the .js and two .php files that changed, so you can just copy those over the ones in your current installation)

But here is the deal, these are very large files that will fail for a lot of reasons.  The Zip file likes to timeout during the download on slow hosts, or ones that don't allow a long enough connection.  Then there is the memory issue during unzip, mostly on hosts that don't have the zip library installed, then there is the sql import, and if your host does not have the csv import capability enabled then you are SOL.  There is not much I can do about that in the mod to work around those host issues.
Title: Re: geoIP (IP to Location)
Post by: SugarD-x on May 28, 2013, 11:49:46 AM
I made a couple of minor updates on the github repo here: https://github.com/Spuds/GeoIP
Aren't those already applied to the latest download hosted on SMF? I checked the version numbers of some modified pages and they matched, plus your changelog on the download page says you updated it last month. :P

Edit: Updated them to try anyway. Accessing the geoIP admin page is causing it to display "Fatal error: Call to undefined function geoIPEntry() in /<Board Host Root Location>/Sources/Admin.php on line 638".

Edit #2: Ignore the previous edit. That was a bad download of the files. Redownloaded them and it's working fine again. I'll reply back when I figure out what's going on with the manual update. :)

Edit #3: Ya, it unfortunately didn't solve the issue with grabbing them through any method. Is there a separate script included in the mod that can manually import them to the database when I download the files, or does it have to be run through the admin page only? I'm thinking that if I can run it outside the forum itself, it might tell me where it's breaking in more detail.

Edit #4: I also noticed a small bug in the error log when running the scheduled task for updating. Not sure if it's caused by my situation or not, but I figured it would be worth noting:

Code: [Select]
<Board Host Root Location>/index.php?action=admin;area=scheduledtasks
8: Undefined variable: result
File: /<Board Host Root Location>/Sources/ScheduledTasks.php
Line: 1659

<Board Host Root Location>/index.php?action=admin;area=scheduledtasks
8: Undefined index: geoIP_db
File: /<Board Host Root Location>/Sources/ScheduledTasks.php
Line: 1656

<Board Host Root Location>/index.php?action=admin;area=scheduledtasks
8: Undefined index: geoIP_db
File: /<Board Host Root Location>/Sources/ScheduledTasks.php
Line: 1654
Title: Re: geoIP (IP to Location)
Post by: geogeo.gr on June 06, 2013, 01:12:06 PM
Greek translation (http://www.simplemachines.org/community/index.php?topic=495031.0)
Title: Re: geoIP (IP to Location)
Post by: Manu.G on June 09, 2013, 06:54:00 AM
I made a couple of minor updates on the github repo here: https://github.com/Spuds/GeoIP (https://github.com/Spuds/GeoIP)

Maxmind had moved the location of the larger country/city files and a tweak that will help with some instances of mysql during the import (I think it was just the .js and two .php files that changed, so you can just copy those over the ones in your current installation)

But here is the deal, these are very large files that will fail for a lot of reasons.  The Zip file likes to timeout during the download on slow hosts, or ones that don't allow a long enough connection.  Then there is the memory issue during unzip, mostly on hosts that don't have the zip library installed, then there is the sql import, and if your host does not have the csv import capability enabled then you are SOL.  There is not much I can do about that in the mod to work around those host issues.

I exchanged the updated files but I still get this error
Quote
The Database is not installed
Last Update Status: Database Import Error


What exactly have I to do to get it work again :(
Title: Re: geoIP (IP to Location)
Post by: hall on July 08, 2013, 04:24:44 AM
Dear developer team,

how to install as "database choice - Manual" ? Which files have to be uploaded to <forum>/sources/geoIP. Manual installation seems to be better way to avoid connections failures.
Please reply and greetings,
Miro M.
Title: Re: geoIP (IP to Location)
Post by: Ice_Drake on July 10, 2013, 07:50:46 PM
Well, I am back after a very long period of figuring out how to import the database correctly. I am back to partially guide those who are still having trouble getting this mod to work. Below is a brief overview of what you have to do in order to get this mod to work:

1. Install the mod as normal.

2. Attempt the database installation, which have been failing for me and probably among many others.

3. Create the database tables to match the schema of the downloaded CSV files in phpMyAdmin. Depending of whether you want Country only or with City, you should have different amount of tables. For Country and City, you should have five tables: geoip_blocks, geoip_countries, geoip_ip, geoip_ip_temp, and geoip_regions.

4. Import the contents of those CSV files downloaded from MaxMind to the correct tables. Do the import with the following configuration:

- Fields terminated by ','
- Enclosed by ' " '
- Lines terminated by '\n'
- Ignore 2 lines (only for certain CSV files)

Note that you can run into PHP timeout (of 300 seconds) when attempting to import a large CSV file. If that is the case, you must upload the file first to your server before proceeding with the import using LOAD DATA INFILE query. Depending on which file you are importing, there are two CSV files where you have to ignore the first two lines since they include the copyright and table schema.

5. If you run into import issue where you get an "access denied" message, address the issue with your web hosting provider. For me, my web hosting provider weren't able to locate the issue, so I have to do the import to a private server and export it as sql file and then import to the server via SSH since phpMyAdmin has been giving me lot of problems.

6. After successfully import the contents, change two records in smf_settings table: geoIP_status and geoIP_status_details. Change geoIP_status to 100 and geoIP_status_details to Success.

7. Insert a new record to that table and name it geoIP_db. Set it to 1.

8. Don't bother updating the database afterward. I figure that it will break something.

You should have a working geoIP mod installed.