Article

Flags of users and proxy detector in geolocation mod for Invision Power Board (IPB)

There is a geolocation mod for Invision Power Board (IPB).

The main mod functions:

  • displays the country and flag of user. It is based on API and real geographical (and not invented) data of users;
  • Proxy-, VPN-, TOR autodetector, that helps against spam and hooliganism.

The flag can be displayed:

  • on the main page of the forum, in the "Board Statistics";
  • in the list "Online Users" (also determined for guests);
  • in the members profile;
  • in the list of all members;
  • in posts: in a profile and near the IP address (for moderators).



Features of the mod:

  • caching of API-requests for each session, that allows to reduce significantly the number of requests to the database;
  • API-requests for IP addresses of search bots will not be calculated;
  • mod works with IPB versions 2.1.x, 2.2.x, 2.3.x;
  • country in user's profile is defined by registration and in the future will not be changed, if a certain option is not chosen (so the country in the profile will be always actual);
  • for moderators the actual country will be recorded in each post, near the IP address;
  • the countries names are available in English, Russian, German and Spanish in encodings: UTF-8, ISO-8859-1, WINDOWS-1251, KOI8-R;
  • auto hide the posts written through a Proxy, TOR, Hosting and VPN (the feature can be changed in settings);
  • sorting of members by country.

Settings:

  • Choice between "Country code" and "Service code" (will be available later);
  • auto hiding of posts;
  • actualisation of the user's profile;
  • possibility to show the flag anywhere in the forum to certain groups.

Download geolocation mod and installation instruction:

A script is in mod available to determine the countries of already registered users and the previous posts, it is also possible (ipbgeo_update.php) to download separately. (new version 1.5, 12.Dec.08)
The function "service code" (for proxy detector) will also be available later.

All updates and news about the geolocation mod are in the comments to this article, so you can subscribe to comments(RSS) to be well informed.

De-Light Russia23 Oct 2008 20:10#32Русский   
wipmania logo Alrond 24 Oct 2008 04:10#33Русский   
De-Light Russia25 Oct 2008 06:10#34Русский   
wipmania logo Alrond 28 Oct 2008 06:10#35Русский   
wipmania logo Alrond 12 Nov 2008 18:11#46Русский   
wipmania logo Alrond 15 Nov 2008 09:11#51Deutsch   
wipmania logo Alrond 15 Nov 2008 09:11#52English   
Updates of version 1.1:
  • Added the possibility to display a list of countries with the number of online-users of each of them
  • Added the country-update script for old posts and users
  • Added support for mods Members Online Today and "Who Was Online Today"
Tripp United States30 Nov 2008 14:11#72English   
Alright, just went through the install, and after a while the ipbgeo_update.php turned out this:
Script for update countries in users profiles and posts. Geomod for Invision Power Board by WIPmania.com.
52992 undefined users and 72959 posts.

Warning: fsockopen() [function.fsockopen]: unable to connect to api.wipmania.com:80 (Connection timed out) in /home/theviper/public_html/ipbgeo_update.php on line 213
Connection timed out (110)


So I'm running it again right now after changing the max runtime for PHP from 30 to 3000 (just for kicks) and told CSF+LFD to ignore the script, and I get the same error message again, and this is how my forums look now:
http://i37.tinypic.com/2s8segk.jpg


A little help here?

And I'm pretty sure my firewall isn't blocking anything because I can use Rapidleech to download from YouTube and Rapidshare just fine, and IP.B and all of the mods I have for it can phone home to check for updates.
wipmania logo Alrond 30 Nov 2008 16:11#73English   
Alright, just went through the install, and after a while the ipbgeo_update.php turned out this:

I see you have access to API, but after start and few seconds later you socket is blocked.
Try to change line 210
if ((getmicrotime()-$time_start) > round($max_execution_time*0.5))

like
if ((getmicrotime()-$time_start) > round($max_execution_time*0.1))

and reduce your max "max_execution_time" to standard value.

and this is how my forums look now

The section "Active users" is independent of ipbgeo_update.php, I think you have error with mod install, could you compare step 8 "/sources/lib/func_boardstats.php"?
Or you can send me this file and "/sources/classes/class_session.php"
Tripp United States30 Nov 2008 20:11#75English   
Looked over the func_boardstats and turned out I had missed a comma. Hopefully that fixes things up. But when I run the updater (after applying your recommended changes) I got this:
Script for update countries in users profiles and posts. Geomod for Invision Power Board by WIPmania.com.
53055 undefined users and 72967 posts.

Warning: fsockopen() [function.fsockopen]: unable to connect to api.wipmania.com:80 (Operation now in progress) in /home/theviper/public_html/ipbgeo_update.php on line 213
Operation now in progress (115)
wipmania logo Alrond 01 Dec 2008 13:12#79English   
It seems to be a bug in PHP
see
http://www.justskins.com/forums/39803-new-fsockopen-bug-62808.html
http://bugs.php.net/bug.php?id=38568

http://de3.php.net/manual/en/function.socket-connect.php
"Return Values"...Note: If the socket is non-blocking then this function returns FALSE with an error Operation now in progress.
(30-Apr-2003 05:12):
If you're using non-blocking, be sure not to turn it on until after you connect, otherwise you will get the mesasge:
PHP Warning: socket_connect() unable to connect [115]: Operation now in progress in file.php on line 123
and socket_connect() will return false (even though it will connect).


May be you have limit of socket connections?
Try to insert a pause (line 212):
if (!$ip_old[$k]){
into
if (!$ip_old[$k]){ sleep(0.3);
Tripp United States01 Dec 2008 16:12#84English   
Did that, and it's going through now... Very slowly... It's doing about 1 member per 20 seconds, and I have a forum of over 50,000 members, so I have a feeling I'm going to be doing this for a while...

If I have more problems, I'll be sure to post. And now, my forum looks like this (with 52936 undefined users and 69497 posts):
http://i37.tinypic.com/w7o3r5.jpg

EDIT: Got this after a while:
Script for update countries in users profiles and posts. Geomod for Invision Power Board by WIPmania.com.
52767 undefined users and 67089 posts.

Warning: fsockopen() [function.fsockopen]: unable to connect to api.wipmania.com:80 (Connection timed out) in /home/theviper/public_html/ipbgeo_update.php on line 213

Connection timed out (110)[/quote]
wipmania logo Alrond 01 Dec 2008 17:12#85English   
I think you have problem with socket limits (I see ZZ.png in list of countries - it means this session could not connect to API).
I see you use latest stable PHP under Apache, but why you don't use frontend web-server like nginx or lighttpd befor Apache to increase your performance?
Main question: do you have VPS(if yes: XEN,OpenVZ or ...) or dedicated server? Linux, FreeBSD?
Make this commands:
cat /proc/user_beancounters | grep numtcpsock (by OpenVZ)

ulimit -a
sysctl -a | grep max | grep net
cat /etc/security/limits.conf | grep -v '#'
netstat -s

you can send through contact form or email
wipmania logo Alrond 12 Dec 2008 08:12#105Русский   
wipmania logo Alrond 12 Dec 2008 08:12#108English   
New version of update script 1.5
Bugfix: members w/o posts
wipmania logo Alrond 12 Dec 2008 08:12#109Deutsch   
Etpu Russia02 Jan 2009 23:01#203Русский   
Anonymous United States22 Jan 2009 06:01#497Русский   
openid logo medplanet United States17 Feb 2009 22:02#648Русский   
Frutti Israel03 Mar 2009 11:03#666Русский   
wipmania logo Alrond 09 Mar 2009 15:03#695Русский   
Frutti Israel08 Mar 2009 13:03#689Русский   
wipmania logo Alrond 09 Mar 2009 15:03#696Русский   
wipmania logo Alrond 09 Mar 2009 15:03#697Русский   
Korben Kazakhstan08 May 2009 03:05#906Русский   
donaviamoris Ukraine25 Jul 2009 03:07#1410Русский   
wipmania logo Alrond 30 Jul 2009 14:07#1476Русский   
almajd Ukraine29 Aug 2009 13:08#1626Русский   
wipmania logo Alrond 29 Aug 2009 14:08#1629Русский   
Demeter Ukraine19 Aug 2010 16:08#2719Русский   
wipmania logo Alrond 30 Aug 2010 14:08#2747Русский   
Demeter Ukraine28 Oct 2010 12:10#2958Русский   
wipmania logo Alrond 13 Nov 2010 08:11#2989Русский   

Anonymous/Name OpenID OpenID Yahoo! OpenID AOL WordPress LiveJournal TypePad Vox Myvidoop Orange Yandex YandexBlog Mixi Myspace Flickr Verisign MyOpenID ClaimID

All fields are not required

Leave blank for main post.
Comment - 5000 characters maximum. BBcode is allowed.

Subscribe to answers: to all comments:RSS comments (en)

Please have a look at our
Facebook Page and leave a comment

Creative Commons License
Creative Commons Attribution-Noncommercial 3.0 License