Sunday, October 02, 2005

Locate IP addresses

This blog post has moved. Please find it at:

http://www.mpopp.net/2005/10/locate-ip-addresses/.

5 comments:

M.Med said...

thank you :)

Anonymous said...

Many Thanks ... very helpful ...

Unknown said...

You can also show an image on your website to show visitor IP address and country flag. Just go to the website findmyipaddress.info. copy the code and paste it in your website

Anonymous said...

Just a hint, mysql already has INET_ATON() builtin function to convert an IP address to it's numeric representation.

Unknown said...

I found that when using ip's from Australia the query time was significantly higher, and would at some stage stop using the index for table "b" (ip_countries) and perform a full search.

I wrote up a different query which seems to work a treat:
select straight_join b.country from ip_ranges a, ip_countries b where a.ip_from<=3405775035 and a.ip_to>=3405775035 and b.code=a.code limit 1;

The straight_join ensures that the table join order is the same as described in the from section of the query, and that the index is used.