Next Previous Contents

6. Using the software

We now have two php programs that can be used, one is countryiptables.php and the other is iptocountry.php. Let's check out iptocountry.php first and get familiar with it. This will help to understand what takes place when we run the countryiptables.php program.

Just as with the setup program, point your browser to iptocountry.php:

http://yourwebsite.com/country/iptocountry.php

You'll get a page showing a brief help message along with a text box and a clickable button. Enter an IP address into the text box and then click on "Get IP Info".

A page will appear that will display the address you entered along with a version of the address in a long decimal format. The long decimal format is basically the four ip address bytes multiplied out to the full 32-bit number they represent. For most purposes, you can ignore the long decimal results, but they are included in case you have a need for them. I use them for manually looking through the database files and comparing ranges of addresses.

Also displayed is the range of ip addresses that your request matches up with along with the country that this range belongs to. Then below this are two columns of info. In the left column are 6 ranges of ip addresses listed that appear numerically ahead of your request. Likewise, in the column to the right are 6 ranges of ip addresses listed that appear numerically after your request. You can use this information when you wish to find larger blocks of ip addresses than just the one that matches your request.

When you use this program, you'll notice that sometimes it provides a response quite rapidly while other times, it seems to take longer. The difference is due to the ip address you are requesting info on. Some ranges are broken up real badly with very small chunks distributed here and there. When the program encounters those ranges, there is a tremendous amount of data to search through and calculate. But even on a fairly slow server, the wait isn't bad, it's just that you will notice a difference depending on the address you enter.

Play with this program and get used to it. You'll find it's very handy and really helps when you want to find the info you need.


Next Previous Contents