<?php
$landen = array (
"ad" => "Andorra",
"ae" => "United Arab Emirates",
"af" => "Afghanistan",
"ag" => "Antigua en Barbuda",
"ai" => "Anguilla",
"al" => "Albania",
"am" => "Armenië",
"an" => "Nederlands Antille",
"ao" => "Angola",
"aq" => "Antartica",
"ar" => "Argentinië",
"as" => "American Samoa",
"at" => "Austria",
"au" => "Australië",
"aw" => "Aruba",
"az" => "Azerbaijan",
"ba" => "Bosnia Herzegovina",
"bb" => "Barbados",
"bd" => "Bangladesh",
"be" => "België",
"bf" => "Burkina Faso",
"bg" => "Bulgarijë",
"bh" => "Bahrain",
"bi" => "Burundi",
"bj" => "Benin",
"bm" => "Bermuda",
"bn" => "Brunei Darussalam",
"bo" => "Bolivia",
"br" => "Brazil",
"bs" => "Bahamas",
"bt" => "Bhutan",
"bv" => "Bouvet Eilanden",
"bw" => "Botswana",
"by" => "Belarus",
"bz" => "Belize",
"ca" => "Canada",
"cc" => "Cocos (Keeling) Islands",
"cf" => "Central African Republic",
"cg" => "Kongo",
"ch" => "Zwitserland",
"ci" => "Cote DIvoire",
"ck" => "Cook Eilanden",
"cl" => "Chile",
"cm" => "Kameroen",
"cn" => "China",
"co" => "Colombië",
"cr" => "Costa Rica",
"cs" => "Czechoslovakia",
"cu" => "Cuba",
"cv" => "Cape Verde",
"cx" => "Kerstmis Eilnaden",
"cy" => "Cyprus",
"cz" => "Czech Republic",
"de" => "Duitsland",
"dj" => "Djibouti",
"dk" => "Denemarken",
"dm" => "Dominica",
"do" => "Dominicaanse Republiek",
"dz" => "Algeria",
"ec" => "Ecuador",
"ee" => "Estonia",
"eg" => "Egypte",
"eh" => "West Sahara",
"er" => "Eritrea",
"es" => "Spanje",
"et" => "Ethiopia",
"fi" => "Finland",
"fj" => "Fiji",
"fk" => "Falkland Eilanden (Malvinas)",
"fm" => "Micronesia",
"fo" => "Faroe Eilanden",
"fr" => "Frankrijk",
"fx" => "Frankrijk (Metropolitan)",
"ga" => "Gabon",
"gb" => "Groot Britannië (UK)",
"gd" => "Grenada",
"ge" => "Georgië",
"gf" => "Frans Guinea",
"gh" => "Ghana",
"gi" => "Gibraltar",
"gl" => "Groenland",
"gm" => "Gambia",
"gn" => "Guinea",
"gp" => "Guadeloupe",
"gq" => "Equatorial Guinea",
"gr" => "Griekenland",
"gs" => "S. Georgia en S. Sandwich Eilanden",
"gt" => "Guatemala",
"gu" => "Guam",
"gw" => "Guinea-Bissau",
"gy" => "Guyana",
"hk" => "Hong Kong",
"hm" => "Heard en McDonald Eilanden",
"hn" => "Honduras",
"hr" => "Kroatië",
"ht" => "Haiti",
"hu" => "Hongarijë",
"id" => "Indonesia",
"ie" => "Ireland",
"il" => "Israël",
"in" => "India",
"io" => "British Indian Ocean Territory",
"iq" => "Irak",
"ir" => "Iran",
"is" => "Ijsland",
"it" => "Italy",
"jm" => "Jamaica",
"jo" => "Jordanië",
"jp" => "Japan",
"ke" => "Kenya",
"kg" => "Kyrgyzstan",
"kh" => "Cambodia",
"ki" => "Kiribati",
"km" => "Comoros",
"kn" => "Saint Kitts and Nevis",
"kp" => "Noord Korea",
"kr" => "Zuid Korea",
"kw" => "Kuwait",
"ky" => "Kaaiman Eilanden",
"kz" => "Kazakhstan",
"la" => "Laos",
"lb" => "Libanon",
"lc" => "Saint Lucia",
"li" => "Liechtenstein",
"lk" => "Sri Lanka",
"lr" => "Liberia",
"ls" => "Lesotho",
"lt" => "Lithuania",
"lu" => "Luxemburg",
"lv" => "Latvia",
"ly" => "Libya",
"ma" => "Morocco",
"mc" => "Monaco",
"md" => "Moldova",
"mg" => "Madagascar",
"mh" => "Marshall Islands",
"mk" => "Macedonia",
"ml" => "Mali",
"mm" => "Myanmar",
"mn" => "Mongolia",
"mo" => "Macau",
"mp" => "Northern Mariana Eilanden",
"mq" => "Martinique",
"mr" => "Mauritania",
"ms" => "Montserrat",
"mt" => "Malta",
"mu" => "Mauritius",
"mv" => "Maldives",
"mw" => "Malawi",
"mx" => "Mexico",
"my" => "Malaysia",
"mz" => "Mozambique",
"na" => "Namibia",
"nc" => "New Caledonia",
"ne" => "Niger",
"nf" => "Norfolk Island",
"ng" => "Nigeria",
"ni" => "Nicaragua",
"nl" => "Nederland",
"no" => "Norway",
"np" => "Nepal",
"nr" => "Nauru",
"nt" => "Neutral Zone",
"nu" => "Niue",
"nz" => "New Zealand (Aotearoa)",
"om" => "Oman",
"pa" => "Panama",
"pe" => "Peru",
"pf" => "French Polynesia",
"pg" => "Papua New Guinea",
"ph" => "Philippines",
"pk" => "Pakistan",
"pl" => "Poland",
"pm" => "St. Pierre en Miquelon",
"pn" => "Pitcairn",
"pr" => "Puerto Rico",
"pt" => "Portugal",
"pw" => "Palau",
"py" => "Paraguay",
"qa" => "Qatar",
"re" => "Reunion",
"ro" => "Romenië",
"ru" => "Rusland",
"rw" => "Rwanda",
"sa" => "Saudi Arabia",
"sb" => "Salamon Eilanden",
"sc" => "Seychelles",
"sd" => "Sudan",
"se" => "Sweden",
"sg" => "Singapore",
"sh" => "St. Helena",
"si" => "Slovenia",
"sj" => "Svalbard en Jan Mayen Eilanden",
"sk" => "Slovaakse Republiek",
"sl" => "Sierra Leone",
"sm" => "San Marino",
"sn" => "Senegal",
"so" => "Somalia",
"sr" => "Suriname",
"st" => "Sao Tome en Principe",
"su" => "USSR (Former)",
"sv" => "El Salvador",
"sy" => "Syria",
"sz" => "Swaziland",
"tc" => "Turkse en Caicos Eilanden",
"td" => "Chad",
"tf" => "Franse Zuidelijke Teretoriums",
"tg" => "Togo",
"th" => "Thailand",
"tj" => "Tajikistan",
"tk" => "Tokelau",
"tm" => "Turkmenistan",
"tn" => "Tunisia",
"to" => "Tonga",
"tp" => "Oost Timor",
"tr" => "Turkeije",
"tt" => "Trinidad and Tobago",
"tv" => "Tuvalu",
"tw" => "Taiwan",
"tz" => "Tanzania",
"ua" => "Ukraine",
"ug" => "Uganda",
"uk" => "Vereningde Staten",
"um" => "US Minor Outlying Eilanden",
"us" => "United States",
"uy" => "Uruguay",
"uz" => "Uzbekistan",
"va" => "Vatican City State (Holy See)",
"vc" => "Saint Vincent and the Grenadines",
"ve" => "Venezuela",
"vg" => "Virgin Islands (British)",
"vi" => "Virgin Islands (US)",
"vn" => "Vietnam",
"vu" => "Vanuatu",
"wf" => "Wallis and Futuna Islands",
"ws" => "Samoa",
"ye" => "Yemen",
"yt" => "Mayotte",
"yu" => "Yugoslavia",
"za" => "South Africa",
"zm" => "Zambia",
"zr" => "Zaire",
"zw" => "Zimbabwe",
"com" => "US Commercieel",
"edu" => "US Educatie",
"gov" => "US Regering",
"int" => "Internationaal",
"mil" => "US Leger",
"net" => "Netwerk",
"org" => "Non-Profit Organizatien",
"arpa" => "Old-Style Arpanet",
"nato" => "NATO Field"
);
function getCountry( $ip )
{
global $landen; // Landen array ophalen zodat we die kunne gebruiken
$host = gethostbyaddr( $ip ); // Host ophalen d.m.v. het ip adres
if( $host == $ip )
{
// De host is hetzelfde als het ip adres dus land is Onbekend
return "Onbekend";
}
$hostsplit = explode( ".", $host ); // Hak de host in stukjes op de punt
$ext = array_pop( $hostsplit ); // Pak het laatste item
if( IsSet( $landen[$ext] ) )
{
// Het land staat in de array
$land = $landen[$ext];
}
else
{
// Het land staat niet in de array
$land = "Onbekend";
}
return $land; // Return het land
}
echo getCountry( $_SERVER['REMOTE_ADDR'] );
?>
<?php "ad" => "Andorra", "ae" => "United Arab Emirates", "af" => "Afghanistan", "ag" => "Antigua en Barbuda", "ai" => "Anguilla", "al" => "Albania", "am" => "Armenië", "an" => "Nederlands Antille", "ao" => "Angola", "aq" => "Antartica", "ar" => "Argentinië", "as" => "American Samoa", "at" => "Austria", "au" => "Australië", "aw" => "Aruba", "az" => "Azerbaijan", "ba" => "Bosnia Herzegovina", "bb" => "Barbados", "bd" => "Bangladesh", "be" => "België", "bf" => "Burkina Faso", "bg" => "Bulgarijë", "bh" => "Bahrain", "bi" => "Burundi", "bj" => "Benin", "bm" => "Bermuda", "bn" => "Brunei Darussalam", "bo" => "Bolivia", "br" => "Brazil", "bs" => "Bahamas", "bt" => "Bhutan", "bv" => "Bouvet Eilanden", "bw" => "Botswana", "by" => "Belarus", "bz" => "Belize", "ca" => "Canada", "cc" => "Cocos (Keeling) Islands", "cf" => "Central African Republic", "cg" => "Kongo", "ch" => "Zwitserland", "ci" => "Cote DIvoire", "ck" => "Cook Eilanden", "cl" => "Chile", "cm" => "Kameroen", "cn" => "China", "co" => "Colombië", "cr" => "Costa Rica", "cs" => "Czechoslovakia", "cu" => "Cuba", "cv" => "Cape Verde", "cx" => "Kerstmis Eilnaden", "cy" => "Cyprus", "cz" => "Czech Republic", "de" => "Duitsland", "dj" => "Djibouti", "dk" => "Denemarken", "dm" => "Dominica", "do" => "Dominicaanse Republiek", "dz" => "Algeria", "ec" => "Ecuador", "ee" => "Estonia", "eg" => "Egypte", "eh" => "West Sahara", "er" => "Eritrea", "es" => "Spanje", "et" => "Ethiopia", "fi" => "Finland", "fj" => "Fiji", "fk" => "Falkland Eilanden (Malvinas)", "fm" => "Micronesia", "fo" => "Faroe Eilanden", "fr" => "Frankrijk", "fx" => "Frankrijk (Metropolitan)", "ga" => "Gabon", "gb" => "Groot Britannië (UK)", "gd" => "Grenada", "ge" => "Georgië", "gf" => "Frans Guinea", "gh" => "Ghana", "gi" => "Gibraltar", "gl" => "Groenland", "gm" => "Gambia", "gn" => "Guinea", "gp" => "Guadeloupe", "gq" => "Equatorial Guinea", "gr" => "Griekenland", "gs" => "S. Georgia en S. Sandwich Eilanden", "gt" => "Guatemala", "gu" => "Guam", "gw" => "Guinea-Bissau", "gy" => "Guyana", "hk" => "Hong Kong", "hm" => "Heard en McDonald Eilanden", "hn" => "Honduras", "hr" => "Kroatië", "ht" => "Haiti", "hu" => "Hongarijë", "id" => "Indonesia", "ie" => "Ireland", "il" => "Israël", "in" => "India", "io" => "British Indian Ocean Territory", "iq" => "Irak", "ir" => "Iran", "is" => "Ijsland", "it" => "Italy", "jm" => "Jamaica", "jo" => "Jordanië", "jp" => "Japan", "ke" => "Kenya", "kg" => "Kyrgyzstan", "kh" => "Cambodia", "ki" => "Kiribati", "km" => "Comoros", "kn" => "Saint Kitts and Nevis", "kp" => "Noord Korea", "kr" => "Zuid Korea", "kw" => "Kuwait", "ky" => "Kaaiman Eilanden", "kz" => "Kazakhstan", "la" => "Laos", "lb" => "Libanon", "lc" => "Saint Lucia", "li" => "Liechtenstein", "lk" => "Sri Lanka", "lr" => "Liberia", "ls" => "Lesotho", "lt" => "Lithuania", "lu" => "Luxemburg", "lv" => "Latvia", "ly" => "Libya", "ma" => "Morocco", "mc" => "Monaco", "md" => "Moldova", "mg" => "Madagascar", "mh" => "Marshall Islands", "mk" => "Macedonia", "ml" => "Mali", "mm" => "Myanmar", "mn" => "Mongolia", "mo" => "Macau", "mp" => "Northern Mariana Eilanden", "mq" => "Martinique", "mr" => "Mauritania", "ms" => "Montserrat", "mt" => "Malta", "mu" => "Mauritius", "mv" => "Maldives", "mw" => "Malawi", "mx" => "Mexico", "my" => "Malaysia", "mz" => "Mozambique", "na" => "Namibia", "nc" => "New Caledonia", "ne" => "Niger", "nf" => "Norfolk Island", "ng" => "Nigeria", "ni" => "Nicaragua", "nl" => "Nederland", "no" => "Norway", "np" => "Nepal", "nr" => "Nauru", "nt" => "Neutral Zone", "nu" => "Niue", "nz" => "New Zealand (Aotearoa)", "om" => "Oman", "pa" => "Panama", "pe" => "Peru", "pf" => "French Polynesia", "pg" => "Papua New Guinea", "ph" => "Philippines", "pk" => "Pakistan", "pl" => "Poland", "pm" => "St. Pierre en Miquelon", "pn" => "Pitcairn", "pr" => "Puerto Rico", "pt" => "Portugal", "pw" => "Palau", "py" => "Paraguay", "qa" => "Qatar", "re" => "Reunion", "ro" => "Romenië", "ru" => "Rusland", "rw" => "Rwanda", "sa" => "Saudi Arabia", "sb" => "Salamon Eilanden", "sc" => "Seychelles", "sd" => "Sudan", "se" => "Sweden", "sg" => "Singapore", "sh" => "St. Helena", "si" => "Slovenia", "sj" => "Svalbard en Jan Mayen Eilanden", "sk" => "Slovaakse Republiek", "sl" => "Sierra Leone", "sm" => "San Marino", "sn" => "Senegal", "so" => "Somalia", "sr" => "Suriname", "st" => "Sao Tome en Principe", "su" => "USSR (Former)", "sv" => "El Salvador", "sy" => "Syria", "sz" => "Swaziland", "tc" => "Turkse en Caicos Eilanden", "td" => "Chad", "tf" => "Franse Zuidelijke Teretoriums", "tg" => "Togo", "th" => "Thailand", "tj" => "Tajikistan", "tk" => "Tokelau", "tm" => "Turkmenistan", "tn" => "Tunisia", "to" => "Tonga", "tp" => "Oost Timor", "tr" => "Turkeije", "tt" => "Trinidad and Tobago", "tv" => "Tuvalu", "tw" => "Taiwan", "tz" => "Tanzania", "ua" => "Ukraine", "ug" => "Uganda", "uk" => "Vereningde Staten", "um" => "US Minor Outlying Eilanden", "us" => "United States", "uy" => "Uruguay", "uz" => "Uzbekistan", "va" => "Vatican City State (Holy See)", "vc" => "Saint Vincent and the Grenadines", "ve" => "Venezuela", "vg" => "Virgin Islands (British)", "vi" => "Virgin Islands (US)", "vn" => "Vietnam", "vu" => "Vanuatu", "wf" => "Wallis and Futuna Islands", "ws" => "Samoa", "ye" => "Yemen", "yt" => "Mayotte", "yu" => "Yugoslavia", "za" => "South Africa", "zm" => "Zambia", "zr" => "Zaire", "zw" => "Zimbabwe", "com" => "US Commercieel", "edu" => "US Educatie", "gov" => "US Regering", "int" => "Internationaal", "mil" => "US Leger", "net" => "Netwerk", "org" => "Non-Profit Organizatien", "arpa" => "Old-Style Arpanet", "nato" => "NATO Field" ); function getCountry( $ip ) { global $landen; // Landen array ophalen zodat we die kunne gebruiken $host = gethostbyaddr( $ip ); // Host ophalen d.m.v. het ip adres if( $host == $ip ) { // De host is hetzelfde als het ip adres dus land is Onbekend return "Onbekend"; } $hostsplit = explode( ".", $host ); // Hak de host in stukjes op de punt $ext = array_pop( $hostsplit ); // Pak het laatste item if( IsSet( $landen[$ext] ) ) { // Het land staat in de array $land = $landen[$ext]; } else { // Het land staat niet in de array $land = "Onbekend"; } return $land; // Return het land } echo getCountry ( $_SERVER['REMOTE_ADDR'] ); ?>
Download code (.txt)
|