login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > PHP > Statistieken > ISP van een bezoeker weergeven

ISP van een bezoeker weergeven

Auteur: AbCkE - 07 februari 2005 - 12:13 - Gekeurd door: Maarten - Hits: 5768 - Aantal punten: 1.75 (8 stemmen)



Dit scriptje is een functie die het land van de bezoeker toon't ...
bv ik kom op mijn site vanijt duitsland dan zal mijn site ook zeggen met deze functie dat ik in duitsland ben dit is dus handig voor een stats script ofzo om je bezoekers van bepaalde landen te tellen ... weet ik veel..

[i]Twopeak edit:[/i] Dit script zal niet perse werken. Indien iemand een anonieme proxy gebruikt; of als de ISP heeft besloten om niet te zeggen vanwaar ze komen zal dit script niet werken.
In de meeste gevallen mag er vanuitgegaan worden dat het wel ok is.

Code:
  1. <?php
  2. function getIsp() {
  3. $ccodes = array (
  4. "ad" => "Andorra",
  5. "ae" => "United Arab Emirates",
  6. "af" => "Afghanistan",
  7. "ag" => "Antigua and Barbuda",
  8. "ai" => "Anguilla",
  9. "al" => "Albania",
  10. "am" => "Armenia",
  11. "an" => "Netherlands Antilles",
  12. "ao" => "Angola",
  13. "aq" => "Antarctica",
  14. "ar" => "Argentina",
  15. "as" => "American Samoa",
  16. "at" => "Austria",
  17. "au" => "Australia",
  18. "aw" => "Aruba",
  19. "az" => "Azerbaijan",
  20. "ba" => "Bosnia Herzegovina",
  21. "bb" => "Barbados",
  22. "bd" => "Bangladesh",
  23. "be" => "Belgium",
  24. "bf" => "Burkina Faso",
  25. "bg" => "Bulgaria",
  26. "bh" => "Bahrain",
  27. "bi" => "Burundi",
  28. "bj" => "Benin",
  29. "bm" => "Bermuda",
  30. "bn" => "Brunei Darussalam",
  31. "bo" => "Bolivia",
  32. "br" => "Brazil",
  33. "bs" => "Bahamas",
  34. "bt" => "Bhutan",
  35. "bv" => "Bouvet Island",
  36. "bw" => "Botswana",
  37. "by" => "Belarus",
  38. "bz" => "Belize",
  39. "ca" => "Canada",
  40. "cc" => "Cocos (Keeling) Islands",
  41. "cf" => "Central African Republic",
  42. "cg" => "Congo",
  43. "ch" => "Switzerland",
  44. "ci" => "Cote DIvoire",
  45. "ck" => "Cook Islands",
  46. "cl" => "Chile",
  47. "cm" => "Cameroon",
  48. "cn" => "China",
  49. "co" => "Colombia",
  50. "cr" => "Costa Rica",
  51. "cs" => "Czechoslovakia",
  52. "cu" => "Cuba",
  53. "cv" => "Cape Verde",
  54. "cx" => "Christmas Island",
  55. "cy" => "Cyprus",
  56. "cz" => "Czech Republic",
  57. "de" => "Germany",
  58. "dj" => "Djibouti",
  59. "dk" => "Denmark",
  60. "dm" => "Dominica",
  61. "do" => "Dominican Republic",
  62. "dz" => "Algeria",
  63. "ec" => "Ecuador",
  64. "ee" => "Estonia",
  65. "eg" => "Egypt",
  66. "eh" => "Western Sahara",
  67. "er" => "Eritrea",
  68. "es" => "Spain",
  69. "et" => "Ethiopia",
  70. "fi" => "Finland",
  71. "fj" => "Fiji",
  72. "fk" => "Falkland Islands (Malvinas)",
  73. "fm" => "Micronesia",
  74. "fo" => "Faroe Islands",
  75. "fr" => "France",
  76. "fx" => "France (Metropolitan)",
  77. "ga" => "Gabon",
  78. "gb" => "Great Britain (UK)",
  79. "gd" => "Grenada",
  80. "ge" => "Georgia",
  81. "gf" => "French Guiana",
  82. "gh" => "Ghana",
  83. "gi" => "Gibraltar",
  84. "gl" => "Greenland",
  85. "gm" => "Gambia",
  86. "gn" => "Guinea",
  87. "gp" => "Guadeloupe",
  88. "gq" => "Equatorial Guinea",
  89. "gr" => "Greece",
  90. "gs" => "S. Georgia and S. Sandwich Islands",
  91. "gt" => "Guatemala",
  92. "gu" => "Guam",
  93. "gw" => "Guinea-Bissau",
  94. "gy" => "Guyana",
  95. "hk" => "Hong Kong",
  96. "hm" => "Heard and McDonald Islands",
  97. "hn" => "Honduras",
  98. "hr" => "Croatia (Hrvatska)",
  99. "ht" => "Haiti",
  100. "hu" => "Hungary",
  101. "id" => "Indonesia",
  102. "ie" => "Ireland",
  103. "il" => "Israel",
  104. "in" => "India",
  105. "io" => "British Indian Ocean Territory",
  106. "iq" => "Iraq",
  107. "ir" => "Iran",
  108. "is" => "Iceland",
  109. "it" => "Italy",
  110. "jm" => "Jamaica",
  111. "jo" => "Jordan",
  112. "jp" => "Japan",
  113. "ke" => "Kenya",
  114. "kg" => "Kyrgyzstan",
  115. "kh" => "Cambodia",
  116. "ki" => "Kiribati",
  117. "km" => "Comoros",
  118. "kn" => "Saint Kitts and Nevis",
  119. "kp" => "North Korea",
  120. "kr" => "South Korea",
  121. "kw" => "Kuwait",
  122. "ky" => "Cayman Islands",
  123. "kz" => "Kazakhstan",
  124. "la" => "Laos",
  125. "lb" => "Lebanon",
  126. "lc" => "Saint Lucia",
  127. "li" => "Liechtenstein",
  128. "lk" => "Sri Lanka",
  129. "lr" => "Liberia",
  130. "ls" => "Lesotho",
  131. "lt" => "Lithuania",
  132. "lu" => "Luxembourg",
  133. "lv" => "Latvia",
  134. "ly" => "Libya",
  135. "ma" => "Morocco",
  136. "mc" => "Monaco",
  137. "md" => "Moldova",
  138. "mg" => "Madagascar",
  139. "mh" => "Marshall Islands",
  140. "mk" => "Macedonia",
  141. "ml" => "Mali",
  142. "mm" => "Myanmar",
  143. "mn" => "Mongolia",
  144. "mo" => "Macau",
  145. "mp" => "Northern Mariana Islands",
  146. "mq" => "Martinique",
  147. "mr" => "Mauritania",
  148. "ms" => "Montserrat",
  149. "mt" => "Malta",
  150. "mu" => "Mauritius",
  151. "mv" => "Maldives",
  152. "mw" => "Malawi",
  153. "mx" => "Mexico",
  154. "my" => "Malaysia",
  155. "mz" => "Mozambique",
  156. "na" => "Namibia",
  157. "nc" => "New Caledonia",
  158. "ne" => "Niger",
  159. "nf" => "Norfolk Island",
  160. "ng" => "Nigeria",
  161. "ni" => "Nicaragua",
  162. "nl" => "The Netherlands",
  163. "no" => "Norway",
  164. "np" => "Nepal",
  165. "nr" => "Nauru",
  166. "nt" => "Neutral Zone",
  167. "nu" => "Niue",
  168. "nz" => "New Zealand (Aotearoa)",
  169. "om" => "Oman",
  170. "pa" => "Panama",
  171. "pe" => "Peru",
  172. "pf" => "French Polynesia",
  173. "pg" => "Papua New Guinea",
  174. "ph" => "Philippines",
  175. "pk" => "Pakistan",
  176. "pl" => "Poland",
  177. "pm" => "St. Pierre and Miquelon",
  178. "pn" => "Pitcairn",
  179. "pr" => "Puerto Rico",
  180. "pt" => "Portugal",
  181. "pw" => "Palau",
  182. "py" => "Paraguay",
  183. "qa" => "Qatar",
  184. "re" => "Reunion",
  185. "ro" => "Romania",
  186. "ru" => "Russian Federation",
  187. "rw" => "Rwanda",
  188. "sa" => "Saudi Arabia",
  189. "sb" => "Solomon Islands",
  190. "sc" => "Seychelles",
  191. "sd" => "Sudan",
  192. "se" => "Sweden",
  193. "sg" => "Singapore",
  194. "sh" => "St. Helena",
  195. "si" => "Slovenia",
  196. "sj" => "Svalbard and Jan Mayen Islands",
  197. "sk" => "Slovak Republic",
  198. "sl" => "Sierra Leone",
  199. "sm" => "San Marino",
  200. "sn" => "Senegal",
  201. "so" => "Somalia",
  202. "sr" => "Suriname",
  203. "st" => "Sao Tome and Principe",
  204. "su" => "USSR (Former)",
  205. "sv" => "El Salvador",
  206. "sy" => "Syria",
  207. "sz" => "Swaziland",
  208. "tc" => "Turks and Caicos Islands",
  209. "td" => "Chad",
  210. "tf" => "French Southern Territories",
  211. "tg" => "Togo",
  212. "th" => "Thailand",
  213. "tj" => "Tajikistan",
  214. "tk" => "Tokelau",
  215. "tm" => "Turkmenistan",
  216. "tn" => "Tunisia",
  217. "to" => "Tonga",
  218. "tp" => "East Timor",
  219. "tr" => "Turkey",
  220. "tt" => "Trinidad and Tobago",
  221. "tv" => "Tuvalu",
  222. "tw" => "Taiwan",
  223. "tz" => "Tanzania",
  224. "ua" => "Ukraine",
  225. "ug" => "Uganda",
  226. "uk" => "United Kingdom",
  227. "um" => "US Minor Outlying Islands",
  228. "us" => "United States",
  229. "uy" => "Uruguay",
  230. "uz" => "Uzbekistan",
  231. "va" => "Vatican City State (Holy See)",
  232. "vc" => "Saint Vincent and the Grenadines",
  233. "ve" => "Venezuela",
  234. "vg" => "Virgin Islands (British)",
  235. "vi" => "Virgin Islands (US)",
  236. "vn" => "Vietnam",
  237. "vu" => "Vanuatu",
  238. "wf" => "Wallis and Futuna Islands",
  239. "ws" => "Samoa",
  240. "ye" => "Yemen",
  241. "yt" => "Mayotte",
  242. "yu" => "Yugoslavia",
  243. "za" => "South Africa",
  244. "zm" => "Zambia",
  245. "zr" => "Zaire",
  246. "zw" => "Zimbabwe",
  247. "com" => "US Commercial",
  248. "edu" => "US Educational",
  249. "gov" => "US Government",
  250. "int" => "International",
  251. "mil" => "US Military",
  252. "net" => "Network",
  253. "org" => "Non-Profit Organization",
  254. "arpa" => "Old-Style Arpanet",
  255. "nato" => "NATO Field"
  256. );
  257. $isp = gethostbyaddr($_SERVER['REMOTE_ADDR']);
  258. $land = substr(strrchr($isp, "."), 1);
  259. $stukjes = explode(".", $isp);
  260. for($i=0; $i <= count($stukjes)-1; $i++) {
  261. $mogel = $stukjes[$i].".".$land;
  262. if (checkdnsrr($mogel) !== false)
  263. $ispq = $stukjes[$i];
  264. }
  265. $isp = ucfirst($ispq);
  266. $land = $ccodes[$land];
  267. return $isp; //verander $ip in $land als je het land wilt retourneren.
  268. }
  269. ?>


echo getIsp();Download code! Download code (.txt)

 Stemmen
Niet ingelogd.

 Reacties
Post een reactie
Lees de reacties (4)
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.058s