Land eines Besuchers ermitteln

Der Browser sendet die IP-Nummer des Besucher-Computers an den Webserver. Diese IP-Nummer ist einem Provider zugeordnet und damit kann man das Land des Besuchers ermitteln.

Listen mit der Zuordnung Land zu IP-Nummer gibt es hier:

http://ip-to-country.webhosting.info/node/view/6
http://ip.ludost.net/

In Mysql werden IP-Nummern am besten als integer gespeichert. Für die Umwandlung von integer zu IP-Nummer gibt es die MySQL-Funktionen INET_ATON und INET_NTOA.

mysql> SELECT INET_ATON('209.207.224.40');
        -> 3520061480

The generated number is always in network byte order. For the example just shown, the number is calculated as 209x2563 + 207×2562 + 224×256 + 40.

mysql> SELECT INET_NTOA(3520061480);
        -> ‘209.207.224.40′

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>