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 Russia24 Oct 2008 03:10#32Русский   
wipmania logo Alex 24 Oct 2008 11:10#33Русский   
De-Light Russia25 Oct 2008 13:10#34Русский   
wipmania logo Alex 28 Oct 2008 12:10#35Русский   
wipmania logo Alex 13 Nov 2008 01:11#46Русский   
wipmania logo Alex 15 Nov 2008 16:11#51Deutsch   
wipmania logo Alex 15 Nov 2008 16: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 21: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 Alex 30 Nov 2008 23: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 States01 Dec 2008 03:12#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 Alex 01 Dec 2008 20: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 23: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 Alex 02 Dec 2008 00: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 Alex 12 Dec 2008 15:12#105Русский   
wipmania logo Alex 12 Dec 2008 15:12#108English   
New version of update script 1.5
Bugfix: members w/o posts
wipmania logo Alex 12 Dec 2008 15:12#109Deutsch   
Etpu Russia03 Jan 2009 06:01#203Русский   

Anonymous/Name OpenID OpenID Yahoo! OpenID AOL WordPress LiveJournal Technorati TypePad Vox Myvidoop Orange Yandex YandexBlog

All fields are not required

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

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

, , , , , , , , , , , , ,

RSS OpenBlog (en)

All topics: 27 (9 on english)

Alex (15)

Olga (6)

Andreas (6)

Forthcoming articles:

"The database of the hosting companies and data centers around the world, proxy-servers, search bots, as well as all satellite providers will be soon available!"

Creative Commons License
Creative Commons Attribution-Noncommercial 3.0 License