Many people could be surprised by that how many sites are authentically capable to define from what country you use the Internet. Such “abilities” except the informative purposes carry also quite practical approach: the western paid sites are afraid to admit to themselves visitors from Russia and the CIS countries. Visitors from some hardly probable begin to buy paid accounts for tens and hundreds dollars for access to a qualitative sensuality or music so why to spend the traffic for potentially inconsistent client for vain?

Determination of the country.

In the Internet there is a database of IP addresses with division on the countries. This basis doesn’t carry however the official status. However it is opened for usage and replenished regularly. To download this database is possible under the link to a site http://ip-to-country.webhosting.info/. A database format is CVS that will confuse the ordinary user but in whom won’t confuse the skilled programmer as the given format is most convenient for import in MySQL. We will look how to import data of Ip-to-Country and how to use it.

Information about IP import:

The file format ip-to-country.csv, loaded by us from the specified site and has the following appearance:

“33996344”, “33996351”, “GB”, “GBR”, “UNITED KINGDOM”

The first 2 numbers are the packed start and finite values of IP diapason, described by the given record (line).

As it is known, the IP address of 4 versions at present used in the core represents 4 8-bit numbers divided by a point. This type is convenient for the person, however isn’t absolutely convenient for techniques. The software uses 32-bit numbers which are those IP addresses. To transform IP address from a numerical type in readable, it is possible to use function PHP long2ip.

Further it is necessary for us to carry out only one instruction of MySQL to load all file dataful. This instruction can be fulfilled and it is immediate from command line of the client mysql if they are accessible to you. For command performance in a script the user MySQL should possess privilege File_priv for operation with operating system files. As a variant, it is possible to load the data in basis on the local computer and then to transfer them on the server.

Typical usage Ip-to-Country

Certain lack is absence in basis Ip-to-Country of such data, as a city and a title of the provider. It narrows down a spectrum of application of basis. However and in such type if to adjust automatic addition of local basis it is possible to reach a lot: it is a site switching on prospective language of the visitor, and display of relevant news, and restriction on a site from the certain countries. The user will estimate attention to himself and will feel that you care about him.

Today the web technologies are very popular. The Internet network is not only a place to entertain but also a spot to make money. Whatever the reason is, to be presented in the Internet one needs a site. And it is the time when the question how to make a website arises. Those who are looking for details on how to build a website, are advised to refer to the Internet itself. It is full of guides on how to make a website and related topics.

In any way, it wouldn’t be smart not to take advantage of this opportunity given to us by modern technologies. Google and other search engines, social networks and forums, blogs – all of them could help to find information on “make a flash website” and similar topics.

Leave a Reply