autocomplete.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <?php
  2. sleep( 3 );
  3. // no term passed - just exit early with no response
  4. if (empty($_GET['term'])) exit ;
  5. $q = strtolower($_GET["term"]);
  6. // remove slashes if they were magically added
  7. if (get_magic_quotes_gpc()) $q = stripslashes($q);
  8. $items = array(
  9. "Great Bittern"=>"Botaurus stellaris",
  10. "Little Grebe"=>"Tachybaptus ruficollis",
  11. "Black-necked Grebe"=>"Podiceps nigricollis",
  12. "Little Bittern"=>"Ixobrychus minutus",
  13. "Black-crowned Night Heron"=>"Nycticorax nycticorax",
  14. "Purple Heron"=>"Ardea purpurea",
  15. "White Stork"=>"Ciconia ciconia",
  16. "Spoonbill"=>"Platalea leucorodia",
  17. "Red-crested Pochard"=>"Netta rufina",
  18. "Common Eider"=>"Somateria mollissima",
  19. "Red Kite"=>"Milvus milvus",
  20. "Hen Harrier"=>"Circus cyaneus",
  21. "Montagu`s Harrier"=>"Circus pygargus",
  22. "Black Grouse"=>"Tetrao tetrix",
  23. "Grey Partridge"=>"Perdix perdix",
  24. "Spotted Crake"=>"Porzana porzana",
  25. "Corncrake"=>"Crex crex",
  26. "Common Crane"=>"Grus grus",
  27. "Avocet"=>"Recurvirostra avosetta",
  28. "Stone Curlew"=>"Burhinus oedicnemus",
  29. "Common Ringed Plover"=>"Charadrius hiaticula",
  30. "Kentish Plover"=>"Charadrius alexandrinus",
  31. "Ruff"=>"Philomachus pugnax",
  32. "Common Snipe"=>"Gallinago gallinago",
  33. "Black-tailed Godwit"=>"Limosa limosa",
  34. "Common Redshank"=>"Tringa totanus",
  35. "Sandwich Tern"=>"Sterna sandvicensis",
  36. "Common Tern"=>"Sterna hirundo",
  37. "Arctic Tern"=>"Sterna paradisaea",
  38. "Little Tern"=>"Sternula albifrons",
  39. "Black Tern"=>"Chlidonias niger",
  40. "Barn Owl"=>"Tyto alba",
  41. "Little Owl"=>"Athene noctua",
  42. "Short-eared Owl"=>"Asio flammeus",
  43. "European Nightjar"=>"Caprimulgus europaeus",
  44. "Common Kingfisher"=>"Alcedo atthis",
  45. "Eurasian Hoopoe"=>"Upupa epops",
  46. "Eurasian Wryneck"=>"Jynx torquilla",
  47. "European Green Woodpecker"=>"Picus viridis",
  48. "Crested Lark"=>"Galerida cristata",
  49. "White-headed Duck"=>"Oxyura leucocephala",
  50. "Pale-bellied Brent Goose"=>"Branta hrota",
  51. "Tawny Pipit"=>"Anthus campestris",
  52. "Whinchat"=>"Saxicola rubetra",
  53. "European Stonechat"=>"Saxicola rubicola",
  54. "Northern Wheatear"=>"Oenanthe oenanthe",
  55. "Savi`s Warbler"=>"Locustella luscinioides",
  56. "Sedge Warbler"=>"Acrocephalus schoenobaenus",
  57. "Great Reed Warbler"=>"Acrocephalus arundinaceus",
  58. "Bearded Reedling"=>"Panurus biarmicus",
  59. "Red-backed Shrike"=>"Lanius collurio",
  60. "Great Grey Shrike"=>"Lanius excubitor",
  61. "Woodchat Shrike"=>"Lanius senator",
  62. "Common Raven"=>"Corvus corax",
  63. "Yellowhammer"=>"Emberiza citrinella",
  64. "Ortolan Bunting"=>"Emberiza hortulana",
  65. "Corn Bunting"=>"Emberiza calandra",
  66. "Great Cormorant"=>"Phalacrocorax carbo",
  67. "Hawfinch"=>"Coccothraustes coccothraustes",
  68. "Common Shelduck"=>"Tadorna tadorna",
  69. "Bluethroat"=>"Luscinia svecica",
  70. "Grey Heron"=>"Ardea cinerea",
  71. "Barn Swallow"=>"Hirundo rustica",
  72. "Hooded Crow"=>"Corvus cornix",
  73. "Dunlin"=>"Calidris alpina",
  74. "Eurasian Pied Flycatcher"=>"Ficedula hypoleuca",
  75. "Eurasian Nuthatch"=>"Sitta europaea",
  76. "Short-toed Tree Creeper"=>"Certhia brachydactyla",
  77. "Wood Lark"=>"Lullula arborea",
  78. "Tree Pipit"=>"Anthus trivialis",
  79. "Eurasian Hobby"=>"Falco subbuteo",
  80. "Marsh Warbler"=>"Acrocephalus palustris",
  81. "Wood Sandpiper"=>"Tringa glareola",
  82. "Tawny Owl"=>"Strix aluco",
  83. "Lesser Whitethroat"=>"Sylvia curruca",
  84. "Barnacle Goose"=>"Branta leucopsis",
  85. "Common Goldeneye"=>"Bucephala clangula",
  86. "Western Marsh Harrier"=>"Circus aeruginosus",
  87. "Common Buzzard"=>"Buteo buteo",
  88. "Sanderling"=>"Calidris alba",
  89. "Little Gull"=>"Larus minutus",
  90. "Eurasian Magpie"=>"Pica pica",
  91. "Willow Warbler"=>"Phylloscopus trochilus",
  92. "Wood Warbler"=>"Phylloscopus sibilatrix",
  93. "Great Crested Grebe"=>"Podiceps cristatus",
  94. "Eurasian Jay"=>"Garrulus glandarius",
  95. "Common Redstart"=>"Phoenicurus phoenicurus",
  96. "Blue-headed Wagtail"=>"Motacilla flava",
  97. "Common Swift"=>"Apus apus",
  98. "Marsh Tit"=>"Poecile palustris",
  99. "Goldcrest"=>"Regulus regulus",
  100. "European Golden Plover"=>"Pluvialis apricaria",
  101. "Eurasian Bullfinch"=>"Pyrrhula pyrrhula",
  102. "Common Whitethroat"=>"Sylvia communis",
  103. "Meadow Pipit"=>"Anthus pratensis",
  104. "Greylag Goose"=>"Anser anser",
  105. "Spotted Flycatcher"=>"Muscicapa striata",
  106. "European Greenfinch"=>"Carduelis chloris",
  107. "Common Greenshank"=>"Tringa nebularia",
  108. "Great Spotted Woodpecker"=>"Dendrocopos major",
  109. "Greater Canada Goose"=>"Branta canadensis",
  110. "Mistle Thrush"=>"Turdus viscivorus",
  111. "Great Black-backed Gull"=>"Larus marinus",
  112. "Goosander"=>"Mergus merganser",
  113. "Great Egret"=>"Casmerodius albus",
  114. "Northern Goshawk"=>"Accipiter gentilis",
  115. "Dunnock"=>"Prunella modularis",
  116. "Stock Dove"=>"Columba oenas",
  117. "Common Wood Pigeon"=>"Columba palumbus",
  118. "Eurasian Woodcock"=>"Scolopax rusticola",
  119. "House Sparrow"=>"Passer domesticus",
  120. "Common House Martin"=>"Delichon urbicum",
  121. "Red Knot"=>"Calidris canutus",
  122. "Western Jackdaw"=>"Corvus monedula",
  123. "Brambling"=>"Fringilla montifringilla",
  124. "Northern Lapwing"=>"Vanellus vanellus",
  125. "European Reed Warbler"=>"Acrocephalus scirpaceus",
  126. "Lesser Black-backed Gull"=>"Larus fuscus",
  127. "Little Egret"=>"Egretta garzetta",
  128. "Little Stint"=>"Calidris minuta",
  129. "Common Linnet"=>"Carduelis cannabina",
  130. "Mute Swan"=>"Cygnus olor",
  131. "Common Cuckoo"=>"Cuculus canorus",
  132. "Black-headed Gull"=>"Larus ridibundus",
  133. "Greater White-fronted Goose"=>"Anser albifrons",
  134. "Great Tit"=>"Parus major",
  135. "Redwing"=>"Turdus iliacus",
  136. "Gadwall"=>"Anas strepera",
  137. "Fieldfare"=>"Turdus pilaris",
  138. "Tufted Duck"=>"Aythya fuligula",
  139. "Crested Tit"=>"Lophophanes cristatus",
  140. "Willow Tit"=>"Poecile montanus",
  141. "Eurasian Coot"=>"Fulica atra",
  142. "Common Blackbird"=>"Turdus merula",
  143. "Smew"=>"Mergus albellus",
  144. "Common Sandpiper"=>"Actitis hypoleucos",
  145. "Sand Martin"=>"Riparia riparia",
  146. "Purple Sandpiper"=>"Calidris maritima",
  147. "Northern Pintail"=>"Anas acuta",
  148. "Blue Tit"=>"Cyanistes caeruleus",
  149. "European Goldfinch"=>"Carduelis carduelis",
  150. "Eurasian Whimbrel"=>"Numenius phaeopus",
  151. "Common Reed Bunting"=>"Emberiza schoeniclus",
  152. "Eurasian Tree Sparrow"=>"Passer montanus",
  153. "Rook"=>"Corvus frugilegus",
  154. "European Robin"=>"Erithacus rubecula",
  155. "Bar-tailed Godwit"=>"Limosa lapponica",
  156. "Dark-bellied Brent Goose"=>"Branta bernicla",
  157. "Eurasian Oystercatcher"=>"Haematopus ostralegus",
  158. "Eurasian Siskin"=>"Carduelis spinus",
  159. "Northern Shoveler"=>"Anas clypeata",
  160. "Eurasian Wigeon"=>"Anas penelope",
  161. "Eurasian Sparrow Hawk"=>"Accipiter nisus",
  162. "Icterine Warbler"=>"Hippolais icterina",
  163. "Common Starling"=>"Sturnus vulgaris",
  164. "Long-tailed Tit"=>"Aegithalos caudatus",
  165. "Ruddy Turnstone"=>"Arenaria interpres",
  166. "Mew Gull"=>"Larus canus",
  167. "Common Pochard"=>"Aythya ferina",
  168. "Common Chiffchaff"=>"Phylloscopus collybita",
  169. "Greater Scaup"=>"Aythya marila",
  170. "Common Kestrel"=>"Falco tinnunculus",
  171. "Garden Warbler"=>"Sylvia borin",
  172. "Eurasian Collared Dove"=>"Streptopelia decaocto",
  173. "Eurasian Skylark"=>"Alauda arvensis",
  174. "Common Chaffinch"=>"Fringilla coelebs",
  175. "Common Moorhen"=>"Gallinula chloropus",
  176. "Water Pipit"=>"Anthus spinoletta",
  177. "Mallard"=>"Anas platyrhynchos",
  178. "Winter Wren"=>"Troglodytes troglodytes",
  179. "Common Teal"=>"Anas crecca",
  180. "Green Sandpiper"=>"Tringa ochropus",
  181. "White Wagtail"=>"Motacilla alba",
  182. "Eurasian Curlew"=>"Numenius arquata",
  183. "Song Thrush"=>"Turdus philomelos",
  184. "European Herring Gull"=>"Larus argentatus",
  185. "Grey Plover"=>"Pluvialis squatarola",
  186. "Carrion Crow"=>"Corvus corone",
  187. "Coal Tit"=>"Periparus ater",
  188. "Spotted Redshank"=>"Tringa erythropus",
  189. "Blackcap"=>"Sylvia atricapilla",
  190. "Egyptian Vulture"=>"Neophron percnopterus",
  191. "Razorbill"=>"Alca torda",
  192. "Alpine Swift"=>"Apus melba",
  193. "Long-legged Buzzard"=>"Buteo rufinus",
  194. "Audouin`s Gull"=>"Larus audouinii",
  195. "Balearic Shearwater"=>"Puffinus mauretanicus",
  196. "Upland Sandpiper"=>"Bartramia longicauda",
  197. "Greater Spotted Eagle"=>"Aquila clanga",
  198. "Ring Ouzel"=>"Turdus torquatus",
  199. "Yellow-browed Warbler"=>"Phylloscopus inornatus",
  200. "Blue Rock Thrush"=>"Monticola solitarius",
  201. "Buff-breasted Sandpiper"=>"Tryngites subruficollis",
  202. "Jack Snipe"=>"Lymnocryptes minimus",
  203. "White-rumped Sandpiper"=>"Calidris fuscicollis",
  204. "Ruddy Shelduck"=>"Tadorna ferruginea",
  205. "Cetti's Warbler"=>"Cettia cetti",
  206. "Citrine Wagtail"=>"Motacilla citreola",
  207. "Roseate Tern"=>"Sterna dougallii",
  208. "Black-legged Kittiwake"=>"Rissa tridactyla",
  209. "Pygmy Cormorant"=>"Phalacrocorax pygmeus",
  210. "Heuglin's Gull"=>"Larus heuglini"
  211. );
  212. $result = array();
  213. foreach ($items as $key=>$value) {
  214. if (strpos(strtolower($key), $q) !== false) {
  215. array_push($result, array("id"=>$value, "label"=>$key, "value" => strip_tags($key)));
  216. }
  217. if (count($result) > 11)
  218. break;
  219. }
  220. // json_encode is available in PHP 5.2 and above, or you can install a PECL module in earlier versions
  221. echo json_encode($result);
  222. ?>