Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[经验] 【分享】刚写好的一个正确判断国内IP的自写函数-by 残月

[复制链接]
wxiong1984 发表于 2009-11-20 15:48:46 | 显示全部楼层 |阅读模式
给有需要的人用的,判断IP为国内还是国外。
  1. <?php
  2. function is_ichinaip($ip){

  3. $cmip_ary=array(
  4. array('110.6.0.0','110.7.255.255'),
  5. array('110.16.0.0','110.19.255.255'),
  6. array('110.40.0.0','110.43.255.255'),
  7. array('110.48.0.0','110.48.255.255'),
  8. array('110.51.0.0','110.51.255.255'),
  9. array('110.52.0.0','110.53.255.255'),
  10. array('110.56.0.0','110.63.255.255'),
  11. array('110.64.0.0','110.65.255.255'),
  12. array('110.72.0.0','110.73.255.255'),
  13. array('110.75.0.0','110.75.255.255'),
  14. array('110.76.0.0','110.76.63.255'),
  15. array('110.76.192.0','110.76.255.255'),
  16. array('110.77.0.0','110.77.127.255'),
  17. array('110.80.0.0','110.87.255.255'),
  18. array('110.88.0.0','110.91.255.255'),
  19. array('110.94.0.0','110.95.255.255'),
  20. array('110.96.0.0','110.127.255.255'),
  21. array('110.152.0.0','110.155.255.255'),
  22. array('110.156.0.0','110.157.255.255'),
  23. array('110.166.0.0','110.167.255.255'),
  24. array('110.172.192.0','110.172.255.255'),
  25. array('110.173.0.0','110.173.31.255'),
  26. array('110.173.32.0','110.173.47.255'),
  27. array('110.173.64.0','110.173.127.255'),
  28. array('110.173.192.0','110.173.223.255'),
  29. array('110.176.0.0','110.191.255.255'),
  30. array('110.192.0.0','110.223.255.255'),
  31. array('110.228.0.0','110.231.255.255'),
  32. array('110.232.32.0','110.232.63.255'),
  33. array('110.236.0.0','110.237.255.255'),
  34. array('110.240.0.0','110.255.255.255'),
  35. array('111.0.0.0','111.63.255.255'),
  36. array('111.66.0.0','111.66.255.255'),
  37. array('111.67.192.0','111.67.207.255'),
  38. array('111.68.64.0','111.68.95.255'),
  39. array('111.72.0.0','111.79.255.255'),
  40. array('111.85.0.0','111.85.255.255'),
  41. array('111.91.192.0','111.91.223.255'),
  42. array('111.112.0.0','111.115.255.255'),
  43. array('111.116.0.0','111.117.255.255'),
  44. array('111.119.64.0','111.119.127.255'),
  45. array('111.119.128.0','111.119.159.255'),
  46. array('111.120.0.0','111.123.255.255'),
  47. array('111.124.0.0','111.124.255.255'),
  48. array('111.126.0.0','111.127.255.255'),
  49. array('111.128.0.0','111.159.255.255'),
  50. array('111.160.0.0','111.167.255.255'),
  51. array('111.170.0.0','111.170.255.255'),
  52. array('111.172.0.0','111.175.255.255'),
  53. array('111.176.0.0','111.183.255.255'),
  54. array('111.186.0.0','111.187.255.255'),
  55. array('111.192.0.0','111.207.255.255'),
  56. array('111.208.0.0','111.215.255.255'),
  57. array('111.221.128.0','111.221.255.255'),
  58. array('111.222.0.0','111.222.255.255'),
  59. array('111.224.0.0','111.231.255.255'),
  60. array('111.235.96.0','111.235.127.255'),
  61. array('111.235.160.0','111.235.191.255'),
  62. array('112.0.0.0','112.63.255.255'),
  63. array('112.64.0.0','112.67.255.255'),
  64. array('112.73.0.0','112.73.255.255'),
  65. array('112.74.0.0','112.75.255.255'),
  66. array('112.80.0.0','112.95.255.255'),
  67. array('112.96.0.0','112.103.255.255'),
  68. array('112.109.128.0','112.109.255.255'),
  69. array('112.111.0.0','112.111.255.255'),
  70. array('112.112.0.0','112.115.255.255'),
  71. array('112.116.0.0','112.117.255.255'),
  72. array('112.122.0.0','112.123.255.255'),
  73. array('112.124.0.0','112.127.255.255'),
  74. array('112.128.0.0','112.131.255.255'),
  75. array('112.132.0.0','112.132.255.255'),
  76. array('112.192.0.0','112.195.255.255'),
  77. array('112.224.0.0','112.255.255.255'),
  78. array('113.0.0.0','113.7.255.255'),
  79. array('113.8.0.0','113.9.255.255'),
  80. array('113.11.192.0','113.11.223.255'),
  81. array('113.12.0.0','113.15.255.255'),
  82. array('113.16.0.0','113.17.255.255'),
  83. array('113.18.0.0','113.18.255.255'),
  84. array('113.24.0.0','113.27.255.255'),
  85. array('113.31.0.0','113.31.255.255'),
  86. array('113.44.0.0','113.47.255.255'),
  87. array('113.48.0.0','113.51.255.255'),
  88. array('113.52.160.0','113.52.191.255'),
  89. array('113.54.0.0','113.55.255.255'),
  90. array('113.56.0.0','113.57.255.255'),
  91. array('113.58.0.0','113.58.255.255'),
  92. array('113.59.0.0','113.59.127.255'),
  93. array('113.62.0.0','113.63.255.255'),
  94. array('113.64.0.0','113.127.255.255'),
  95. array('113.128.0.0','113.129.255.255'),
  96. array('113.130.96.0','113.130.111.255'),
  97. array('113.130.112.0','113.130.119.255'),
  98. array('113.132.0.0','113.135.255.255'),
  99. array('113.136.0.0','113.143.255.255'),
  100. array('113.194.0.0','113.195.255.255'),
  101. array('113.200.0.0','113.201.255.255'),
  102. array('113.202.0.0','113.202.255.255'),
  103. array('113.204.0.0','113.207.255.255'),
  104. array('113.208.96.0','113.208.127.255'),
  105. array('113.208.128.0','113.208.255.255'),
  106. array('113.209.0.0','113.209.255.255'),
  107. array('113.212.0.0','113.212.63.255'),
  108. array('113.213.0.0','113.213.127.255'),
  109. array('113.214.0.0','113.215.255.255'),
  110. array('113.218.0.0','113.219.255.255'),
  111. array('113.220.0.0','113.223.255.255'),
  112. array('113.224.0.0','113.239.255.255'),
  113. array('113.240.0.0','113.247.255.255'),
  114. array('113.248.0.0','113.251.255.255'),
  115. array('114.28.0.0','114.28.255.255'),
  116. array('114.54.0.0','114.55.255.255'),
  117. array('114.60.0.0','114.63.255.255'),
  118. array('114.64.0.0','114.67.255.255'),
  119. array('114.68.0.0','114.68.255.255'),
  120. array('114.80.0.0','114.95.255.255'),
  121. array('114.96.0.0','114.103.255.255'),
  122. array('114.104.0.0','114.107.255.255'),
  123. array('114.110.0.0','114.110.15.255'),
  124. array('114.110.64.0','114.110.127.255'),
  125. array('114.110.128.0','114.110.255.255'),
  126. array('114.111.0.0','114.111.31.255'),
  127. array('114.111.160.0','114.111.191.255'),
  128. array('114.112.0.0','114.119.255.255'),
  129. array('114.132.0.0','114.132.255.255'),
  130. array('114.135.0.0','114.135.255.255'),
  131. array('114.138.0.0','114.139.255.255'),
  132. array('114.141.128.0','114.141.191.255'),
  133. array('114.196.0.0','114.197.255.255'),
  134. array('114.208.0.0','114.223.255.255'),
  135. array('114.224.0.0','114.255.255.255'),
  136. array('115.24.0.0','115.27.255.255'),
  137. array('115.28.0.0','115.29.255.255'),
  138. array('115.32.0.0','115.35.255.255'),
  139. array('115.44.0.0','115.47.255.255'),
  140. array('115.48.0.0','115.63.255.255'),
  141. array('115.84.0.0','115.84.63.255'),
  142. array('115.84.192.0','115.84.223.255'),
  143. array('115.85.192.0','115.85.255.255'),
  144. array('115.100.0.0','115.103.255.255'),
  145. array('115.104.0.0','115.107.255.255'),
  146. array('115.120.0.0','115.123.255.255'),
  147. array('115.124.16.0','115.124.31.255'),
  148. array('115.148.0.0','115.151.255.255'),
  149. array('115.152.0.0','115.159.255.255'),
  150. array('115.168.0.0','115.175.255.255'),
  151. array('115.180.0.0','115.183.255.255'),
  152. array('115.192.0.0','115.223.255.255'),
  153. array('115.224.0.0','115.239.255.255'),
  154. array('116.1.0.0','116.1.255.255'),
  155. array('116.2.0.0','116.3.255.255'),
  156. array('116.4.0.0','116.7.255.255'),
  157. array('116.8.0.0','116.11.255.255'),
  158. array('116.13.0.0','116.13.255.255'),
  159. array('116.16.0.0','116.31.255.255'),
  160. array('116.52.0.0','116.55.255.255'),
  161. array('116.56.0.0','116.57.255.255'),
  162. array('116.58.128.0','116.58.143.255'),
  163. array('116.58.208.0','116.58.223.255'),
  164. array('116.60.0.0','116.63.255.255'),
  165. array('116.66.0.0','116.66.127.255'),
  166. array('116.69.0.0','116.69.255.255'),
  167. array('116.70.0.0','116.70.127.255'),
  168. array('116.76.0.0','116.79.255.255'),
  169. array('116.89.144.0','116.89.159.255'),
  170. array('116.90.80.0','116.90.95.255'),
  171. array('116.90.184.0','116.90.191.255'),
  172. array('116.95.0.0','116.95.255.255'),
  173. array('116.112.0.0','116.115.255.255'),
  174. array('116.116.0.0','116.117.255.255'),
  175. array('116.128.0.0','116.191.255.255'),
  176. array('116.192.0.0','116.192.255.255'),
  177. array('116.193.16.0','116.193.31.255'),
  178. array('116.193.32.0','116.193.63.255'),
  179. array('116.194.0.0','116.195.255.255'),
  180. array('116.196.0.0','116.196.255.255'),
  181. array('116.198.0.0','116.198.255.255'),
  182. array('116.199.0.0','116.199.127.255'),
  183. array('116.199.128.0','116.199.159.255'),
  184. array('116.204.0.0','116.205.255.255'),
  185. array('116.207.0.0','116.207.255.255'),
  186. array('116.208.0.0','116.211.255.255'),
  187. array('116.212.160.0','116.212.175.255'),
  188. array('116.213.64.0','116.213.127.255'),
  189. array('116.213.128.0','116.213.255.255'),
  190. array('116.214.32.0','116.214.63.255'),
  191. array('116.214.64.0','116.214.79.255'),
  192. array('116.214.128.0','116.214.255.255'),
  193. array('116.215.0.0','116.215.255.255'),
  194. array('116.216.0.0','116.219.255.255'),
  195. array('116.224.0.0','116.239.255.255'),
  196. array('116.242.0.0','116.243.255.255'),
  197. array('116.244.0.0','116.247.255.255'),
  198. array('116.248.0.0','116.249.255.255'),
  199. array('116.252.0.0','116.253.255.255'),
  200. array('116.254.128.0','116.254.255.255'),
  201. array('116.255.128.0','116.255.255.255'),
  202. array('117.8.0.0','117.15.255.255'),
  203. array('117.21.0.0','117.21.255.255'),
  204. array('117.22.0.0','117.23.255.255'),
  205. array('117.24.0.0','117.31.255.255'),
  206. array('117.32.0.0','117.39.255.255'),
  207. array('117.40.0.0','117.43.255.255'),
  208. array('117.44.0.0','117.45.255.255'),
  209. array('117.48.0.0','117.51.255.255'),
  210. array('117.53.48.0','117.53.63.255'),
  211. array('117.53.176.0','117.53.191.255'),
  212. array('117.57.0.0','117.57.255.255'),
  213. array('117.58.0.0','117.58.127.255'),
  214. array('117.59.0.0','117.59.255.255'),
  215. array('117.60.0.0','117.63.255.255'),
  216. array('117.64.0.0','117.71.255.255'),
  217. array('117.72.0.0','117.73.255.255'),
  218. array('117.74.64.0','117.74.79.255'),
  219. array('117.74.128.0','117.74.255.255'),
  220. array('117.75.0.0','117.75.255.255'),
  221. array('117.76.0.0','117.79.255.255'),
  222. array('117.80.0.0','117.95.255.255'),
  223. array('117.100.0.0','117.101.255.255'),
  224. array('117.103.16.0','117.103.31.255'),
  225. array('117.103.128.0','117.103.143.255'),
  226. array('117.106.0.0','117.107.255.255'),
  227. array('117.112.0.0','117.119.255.255'),
  228. array('117.120.64.0','117.120.127.255'),
  229. array('117.120.128.0','117.120.255.255'),
  230. array('117.121.0.0','117.121.127.255'),
  231. array('117.121.128.0','117.121.191.255'),
  232. array('117.121.192.0','117.121.199.255'),
  233. array('117.122.128.0','117.122.255.255'),
  234. array('117.124.0.0','117.127.255.255'),
  235. array('117.128.0.0','117.191.255.255'),
  236. array('118.24.0.0','118.31.255.255'),
  237. array('118.64.0.0','118.65.255.255'),
  238. array('118.66.0.0','118.66.255.255'),
  239. array('118.67.112.0','118.67.127.255'),
  240. array('118.72.0.0','118.79.255.255'),
  241. array('118.80.0.0','118.81.255.255'),
  242. array('118.84.0.0','118.85.255.255'),
  243. array('118.88.32.0','118.88.63.255'),
  244. array('118.88.64.0','118.88.127.255'),
  245. array('118.88.128.0','118.88.255.255'),
  246. array('118.89.0.0','118.89.255.255'),
  247. array('118.91.240.0','118.91.255.255'),
  248. array('118.102.16.0','118.102.31.255'),
  249. array('118.112.0.0','118.119.255.255'),
  250. array('118.120.0.0','118.123.255.255'),
  251. array('118.124.0.0','118.125.255.255'),
  252. array('118.126.0.0','118.126.255.255'),
  253. array('118.132.0.0','118.135.255.255'),
  254. array('118.144.0.0','118.147.255.255'),
  255. array('118.178.0.0','118.178.255.255'),
  256. array('118.180.0.0','118.183.255.255'),
  257. array('118.184.0.0','118.191.255.255'),
  258. array('118.192.0.0','118.207.255.255'),
  259. array('118.212.0.0','118.213.255.255'),
  260. array('118.224.0.0','118.227.255.255'),
  261. array('118.228.0.0','118.229.255.255'),
  262. array('118.230.0.0','118.230.255.255'),
  263. array('118.239.0.0','118.239.255.255'),
  264. array('118.242.0.0','118.242.255.255'),
  265. array('118.244.0.0','118.247.255.255'),
  266. array('118.248.0.0','118.255.255.255'),
  267. array('119.0.0.0','119.1.255.255'),
  268. array('119.2.0.0','119.2.31.255'),
  269. array('119.2.128.0','119.2.255.255'),
  270. array('119.3.0.0','119.3.255.255'),
  271. array('119.4.0.0','119.7.255.255'),
  272. array('119.8.0.0','119.9.255.255'),
  273. array('119.10.0.0','119.10.127.255'),
  274. array('119.15.136.0','119.15.143.255'),
  275. array('119.16.0.0','119.16.255.255'),
  276. array('119.18.192.0','119.18.207.255'),
  277. array('119.18.208.0','119.18.215.255'),
  278. array('119.18.224.0','119.18.255.255'),
  279. array('119.19.0.0','119.19.255.255'),
  280. array('119.20.0.0','119.23.255.255'),
  281. array('119.27.64.0','119.27.127.255'),
  282. array('119.27.160.0','119.27.191.255'),
  283. array('119.27.192.0','119.27.255.255'),
  284. array('119.28.0.0','119.29.255.255'),
  285. array('119.30.48.0','119.30.63.255'),
  286. array('119.31.192.0','119.31.223.255'),
  287. array('119.32.0.0','119.39.255.255'),
  288. array('119.40.0.0','119.40.63.255'),
  289. array('119.40.64.0','119.40.79.255'),
  290. array('119.40.128.0','119.40.255.255'),
  291. array('119.41.0.0','119.41.255.255'),
  292. array('119.42.0.0','119.42.63.255'),
  293. array('119.42.136.0','119.42.143.255'),
  294. array('119.42.224.0','119.42.255.255'),
  295. array('119.44.0.0','119.45.255.255'),
  296. array('119.48.0.0','119.55.255.255'),
  297. array('119.57.0.0','119.57.255.255'),
  298. array('119.58.0.0','119.58.255.255'),
  299. array('119.59.128.0','119.59.255.255'),
  300. array('119.60.0.0','119.61.255.255'),
  301. array('119.62.0.0','119.62.255.255'),
  302. array('119.63.32.0','119.63.63.255'),
  303. array('119.75.208.0','119.75.223.255'),
  304. array('119.78.0.0','119.79.255.255'),
  305. array('119.80.0.0','119.81.255.255'),
  306. array('119.84.0.0','119.87.255.255'),
  307. array('119.88.0.0','119.91.255.255'),
  308. array('119.96.0.0','119.103.255.255'),
  309. array('119.108.0.0','119.109.255.255'),
  310. array('119.112.0.0','119.127.255.255'),
  311. array('119.128.0.0','119.143.255.255'),
  312. array('119.144.0.0','119.147.255.255'),
  313. array('119.148.160.0','119.148.175.255'),
  314. array('119.161.128.0','119.161.255.255'),
  315. array('119.162.0.0','119.163.255.255'),
  316. array('119.164.0.0','119.167.255.255'),
  317. array('119.176.0.0','119.191.255.255'),
  318. array('119.232.0.0','119.233.255.255'),
  319. array('119.235.128.0','119.235.191.255'),
  320. array('119.248.0.0','119.251.255.255'),
  321. array('119.253.0.0','119.253.255.255'),
  322. array('119.254.0.0','119.255.255.255'),
  323. array('120.0.0.0','120.15.255.255'),
  324. array('120.24.0.0','120.27.255.255'),
  325. array('120.30.0.0','120.31.255.255'),
  326. array('120.32.0.0','120.47.255.255'),
  327. array('120.48.0.0','120.49.255.255'),
  328. array('120.52.0.0','120.55.255.255'),
  329. array('120.64.0.0','120.71.255.255'),
  330. array('120.72.32.0','120.72.63.255'),
  331. array('120.72.128.0','120.72.255.255'),
  332. array('120.76.0.0','120.79.255.255'),
  333. array('120.80.0.0','120.87.255.255'),
  334. array('120.88.8.0','120.88.15.255'),
  335. array('120.90.0.0','120.91.255.255'),
  336. array('120.92.0.0','120.92.255.255'),
  337. array('120.94.0.0','120.95.255.255'),
  338. array('120.128.0.0','120.135.255.255'),
  339. array('120.136.128.0','120.136.191.255'),
  340. array('120.137.0.0','120.137.127.255'),
  341. array('120.192.0.0','120.255.255.255'),
  342. array('121.0.16.0','121.0.31.255'),
  343. array('121.4.0.0','121.5.255.255'),
  344. array('121.8.0.0','121.15.255.255'),
  345. array('121.16.0.0','121.31.255.255'),
  346. array('121.32.0.0','121.39.255.255'),
  347. array('121.40.0.0','121.43.255.255'),
  348. array('121.46.0.0','121.47.255.255'),
  349. array('121.48.0.0','121.49.255.255'),
  350. array('121.51.0.0','121.51.255.255'),
  351. array('121.52.160.0','121.52.191.255'),
  352. array('121.52.208.0','121.52.223.255'),
  353. array('121.52.224.0','121.52.255.255'),
  354. array('121.55.0.0','121.55.63.255'),
  355. array('121.56.0.0','121.57.255.255'),
  356. array('121.58.0.0','121.58.127.255'),
  357. array('121.58.144.0','121.58.159.255'),
  358. array('121.59.0.0','121.59.255.255'),
  359. array('121.60.0.0','121.63.255.255'),
  360. array('121.68.0.0','121.71.255.255'),
  361. array('121.76.0.0','121.77.255.255'),
  362. array('121.79.128.0','121.79.191.255'),
  363. array('121.89.0.0','121.89.255.255'),
  364. array('121.100.128.0','121.100.255.255'),
  365. array('121.101.208.0','121.101.223.255'),
  366. array('121.192.0.0','121.199.255.255'),
  367. array('121.201.0.0','121.201.255.255'),
  368. array('121.204.0.0','121.207.255.255'),
  369. array('121.224.0.0','121.239.255.255'),
  370. array('121.248.0.0','121.251.255.255'),
  371. array('121.255.0.0','121.255.255.255'),
  372. array('122.0.64.0','122.0.127.255'),
  373. array('122.0.128.0','122.0.255.255'),
  374. array('122.4.0.0','122.7.255.255'),
  375. array('122.8.0.0','122.15.255.255'),
  376. array('122.48.0.0','122.48.255.255'),
  377. array('122.49.0.0','122.49.63.255'),
  378. array('122.51.0.0','122.51.255.255'),
  379. array('122.64.0.0','122.95.255.255'),
  380. array('122.96.0.0','122.97.255.255'),
  381. array('122.102.0.0','122.102.15.255'),
  382. array('122.102.64.0','122.102.95.255'),
  383. array('122.112.0.0','122.115.255.255'),
  384. array('122.119.0.0','122.119.255.255'),
  385. array('122.136.0.0','122.143.255.255'),
  386. array('122.144.128.0','122.144.255.255'),
  387. array('122.152.192.0','122.152.255.255'),
  388. array('122.156.0.0','122.159.255.255'),
  389. array('122.192.0.0','122.195.255.255'),
  390. array('122.198.0.0','122.198.255.255'),
  391. array('122.200.64.0','122.200.127.255'),
  392. array('122.204.0.0','122.207.255.255'),
  393. array('122.224.0.0','122.239.255.255'),
  394. array('122.240.0.0','122.247.255.255'),
  395. array('122.248.48.0','122.248.63.255'),
  396. array('123.0.128.0','123.0.191.255'),
  397. array('123.4.0.0','123.7.255.255'),
  398. array('123.8.0.0','123.15.255.255'),
  399. array('123.49.128.0','123.49.255.255'),
  400. array('123.52.0.0','123.55.255.255'),
  401. array('123.56.0.0','123.63.255.255'),
  402. array('123.64.0.0','123.95.255.255'),
  403. array('123.96.0.0','123.97.255.255'),
  404. array('123.98.0.0','123.98.127.255'),
  405. array('123.99.128.0','123.99.255.255'),
  406. array('123.100.0.0','123.100.31.255'),
  407. array('123.101.0.0','123.101.255.255'),
  408. array('123.103.0.0','123.103.127.255'),
  409. array('123.108.128.0','123.108.143.255'),
  410. array('123.108.208.0','123.108.223.255'),
  411. array('123.112.0.0','123.127.255.255'),
  412. array('123.128.0.0','123.135.255.255'),
  413. array('123.136.80.0','123.136.95.255'),
  414. array('123.137.0.0','123.137.255.255'),
  415. array('123.138.0.0','123.139.255.255'),
  416. array('123.144.0.0','123.159.255.255'),
  417. array('123.160.0.0','123.175.255.255'),
  418. array('123.176.80.0','123.176.95.255'),
  419. array('123.177.0.0','123.177.255.255'),
  420. array('123.178.0.0','123.179.255.255'),
  421. array('123.180.0.0','123.183.255.255'),
  422. array('123.184.0.0','123.191.255.255'),
  423. array('123.196.0.0','123.197.255.255'),
  424. array('123.199.128.0','123.199.255.255'),
  425. array('123.206.0.0','123.207.255.255'),
  426. array('123.232.0.0','123.235.255.255'),
  427. array('123.242.0.0','123.242.127.255'),
  428. array('123.244.0.0','123.247.255.255'),
  429. array('123.249.0.0','123.249.255.255'),
  430. array('123.253.0.0','123.253.255.255'),
  431. array('124.6.64.0','124.6.127.255'),
  432. array('124.14.0.0','124.15.255.255'),
  433. array('124.16.0.0','124.17.255.255'),
  434. array('124.20.0.0','124.23.255.255'),
  435. array('124.28.192.0','124.28.255.255'),
  436. array('124.29.0.0','124.29.127.255'),
  437. array('124.31.0.0','124.31.255.255'),
  438. array('124.40.112.0','124.40.127.255'),
  439. array('124.40.128.0','124.40.191.255'),
  440. array('124.42.0.0','124.42.255.255'),
  441. array('124.47.0.0','124.47.63.255'),
  442. array('124.64.0.0','124.65.255.255'),
  443. array('124.66.0.0','124.66.127.255'),
  444. array('124.67.0.0','124.67.255.255'),
  445. array('124.68.0.0','124.71.255.255'),
  446. array('124.72.0.0','124.79.255.255'),
  447. array('124.88.0.0','124.95.255.255'),
  448. array('124.108.8.0','124.108.15.255'),
  449. array('124.108.40.0','124.108.47.255'),
  450. array('124.112.0.0','124.119.255.255'),
  451. array('124.126.0.0','124.127.255.255'),
  452. array('124.128.0.0','124.135.255.255'),
  453. array('124.147.128.0','124.147.255.255'),
  454. array('124.151.0.0','124.151.255.255'),
  455. array('124.156.0.0','124.156.255.255'),
  456. array('124.160.0.0','124.167.255.255'),
  457. array('124.172.0.0','124.175.255.255'),
  458. array('124.192.0.0','124.193.255.255'),
  459. array('124.196.0.0','124.196.255.255'),
  460. array('124.200.0.0','124.207.255.255'),
  461. array('124.220.0.0','124.223.255.255'),
  462. array('124.224.0.0','124.239.255.255'),
  463. array('124.240.0.0','124.240.127.255'),
  464. array('124.240.128.0','124.240.191.255'),
  465. array('124.242.0.0','124.242.255.255'),
  466. array('124.243.192.0','124.243.255.255'),
  467. array('124.248.0.0','124.248.127.255'),
  468. array('124.249.0.0','124.249.255.255'),
  469. array('124.250.0.0','124.251.255.255'),
  470. array('124.254.0.0','124.254.63.255'),
  471. array('125.31.192.0','125.31.255.255'),
  472. array('125.32.0.0','125.47.255.255'),
  473. array('125.58.128.0','125.58.255.255'),
  474. array('125.61.128.0','125.61.255.255'),
  475. array('125.62.0.0','125.62.63.255'),
  476. array('125.64.0.0','125.95.255.255'),
  477. array('125.96.0.0','125.97.255.255'),
  478. array('125.98.0.0','125.98.255.255'),
  479. array('125.104.0.0','125.111.255.255'),
  480. array('125.112.0.0','125.127.255.255'),
  481. array('125.169.0.0','125.169.255.255'),
  482. array('125.171.0.0','125.171.255.255'),
  483. array('125.208.0.0','125.208.63.255'),
  484. array('125.210.0.0','125.211.255.255'),
  485. array('125.213.0.0','125.213.127.255'),
  486. array('125.214.96.0','125.214.127.255'),
  487. array('125.215.0.0','125.215.63.255'),
  488. array('125.216.0.0','125.223.255.255'),
  489. array('125.254.128.0','125.254.255.255'),
  490. array('134.196.0.0','134.196.255.255'),
  491. array('159.226.0.0','159.226.255.255'),
  492. array('161.207.0.0','161.207.255.255'),
  493. array('162.105.0.0','162.105.255.255'),
  494. array('166.111.0.0','166.111.255.255'),
  495. array('167.139.0.0','167.139.255.255'),
  496. array('168.160.0.0','168.160.255.255'),
  497. array('180.76.0.0','180.79.255.255'),
  498. array('180.84.0.0','180.85.255.255'),
  499. array('180.86.0.0','180.86.255.255'),
  500. array('180.88.0.0','180.91.255.255'),
  501. array('180.94.56.0','180.94.63.255'),
  502. array('180.94.96.0','180.94.111.255'),
  503. array('180.95.128.0','180.95.255.255'),
  504. array('180.96.0.0','180.127.255.255'),
  505. array('180.129.128.0','180.129.255.255'),
  506. array('180.130.0.0','180.130.255.255'),
  507. array('180.136.0.0','180.143.255.255'),
  508. array('180.148.224.0','180.148.255.255'),
  509. array('180.149.128.0','180.149.159.255'),
  510. array('180.150.160.0','180.150.191.255'),
  511. array('180.152.0.0','180.159.255.255'),
  512. array('180.160.0.0','180.175.255.255'),
  513. array('180.178.192.0','180.178.255.255'),
  514. array('180.184.0.0','180.187.255.255'),
  515. array('180.188.0.0','180.188.127.255'),
  516. array('180.189.148.0','180.189.151.255'),
  517. array('180.201.0.0','180.201.255.255'),
  518. array('180.202.0.0','180.203.255.255'),
  519. array('180.208.0.0','180.209.255.255'),
  520. array('180.210.224.0','180.210.255.255'),
  521. array('180.212.0.0','180.213.255.255'),
  522. array('180.222.224.0','180.222.255.255'),
  523. array('180.223.0.0','180.223.255.255'),
  524. array('180.233.0.0','180.233.63.255'),
  525. array('180.233.64.0','180.233.95.255'),
  526. array('180.235.64.0','180.235.95.255'),
  527. array('183.0.0.0','183.63.255.255'),
  528. array('183.64.0.0','183.71.255.255'),
  529. array('183.84.0.0','183.85.255.255'),
  530. array('183.92.0.0','183.95.255.255'),
  531. array('183.128.0.0','183.255.255.255'),
  532. array('192.83.122.0','192.83.122.255'),
  533. array('192.83.169.0','192.83.169.255'),
  534. array('192.124.154.0','192.124.154.255'),
  535. array('192.188.170.0','192.188.170.255'),
  536. array('198.17.7.0','198.17.7.255'),
  537. array('202.0.110.0','202.0.110.255'),
  538. array('202.0.176.0','202.0.179.255'),
  539. array('202.4.128.0','202.4.159.255'),
  540. array('202.4.252.0','202.4.255.255'),
  541. array('202.8.128.0','202.8.159.255'),
  542. array('202.10.64.0','202.10.79.255'),
  543. array('202.14.88.0','202.14.88.255'),
  544. array('202.14.235.0','202.14.235.255'),
  545. array('202.14.236.0','202.14.237.255'),
  546. array('202.14.238.0','202.14.238.255'),
  547. array('202.20.120.0','202.20.120.255'),
  548. array('202.22.248.0','202.22.255.255'),
  549. array('202.38.0.0','202.38.15.255'),
  550. array('202.38.64.0','202.38.127.255'),
  551. array('202.38.128.0','202.38.135.255'),
  552. array('202.38.136.0','202.38.137.255'),
  553. array('202.38.138.0','202.38.138.255'),
  554. array('202.38.140.0','202.38.143.255'),
  555. array('202.38.144.0','202.38.147.255'),
  556. array('202.38.149.0','202.38.149.255'),
  557. array('202.38.150.0','202.38.151.255'),
  558. array('202.38.152.0','202.38.155.255'),
  559. array('202.38.156.0','202.38.156.255'),
  560. array('202.38.158.0','202.38.159.255'),
  561. array('202.38.160.0','202.38.161.255'),
  562. array('202.38.164.0','202.38.167.255'),
  563. array('202.38.168.0','202.38.175.255'),
  564. array('202.38.176.0','202.38.177.255'),
  565. array('202.38.184.0','202.38.191.255'),
  566. array('202.38.192.0','202.38.255.255'),
  567. array('202.41.152.0','202.41.159.255'),
  568. array('202.41.240.0','202.41.255.255'),
  569. array('202.43.76.0','202.43.79.255'),
  570. array('202.43.144.0','202.43.159.255'),
  571. array('202.46.32.0','202.46.63.255'),
  572. array('202.46.224.0','202.46.239.255'),
  573. array('202.60.112.0','202.60.127.255'),
  574. array('202.63.248.0','202.63.251.255'),
  575. array('202.69.4.0','202.69.7.255'),
  576. array('202.69.16.0','202.69.31.255'),
  577. array('202.70.0.0','202.70.31.255'),
  578. array('202.74.8.0','202.74.15.255'),
  579. array('202.75.208.0','202.75.223.255'),
  580. array('202.85.208.0','202.85.223.255'),
  581. array('202.90.0.0','202.90.3.255'),
  582. array('202.90.224.0','202.90.239.255'),
  583. array('202.90.252.0','202.90.255.255'),
  584. array('202.91.0.0','202.91.3.255'),
  585. array('202.91.128.0','202.91.131.255'),
  586. array('202.91.176.0','202.91.191.255'),
  587. array('202.91.224.0','202.91.255.255'),
  588. array('202.92.0.0','202.92.3.255'),
  589. array('202.92.252.0','202.92.255.255'),
  590. array('202.93.0.0','202.93.3.255'),
  591. array('202.93.252.0','202.93.255.255'),
  592. array('202.94.0.0','202.94.31.255'),
  593. array('202.95.0.0','202.95.31.255'),
  594. array('202.95.252.0','202.95.255.255'),
  595. array('202.96.0.0','202.111.255.255'),
  596. array('202.112.0.0','202.119.255.255'),
  597. array('202.120.0.0','202.121.255.255'),
  598. array('202.122.0.0','202.122.7.255'),
  599. array('202.122.32.0','202.122.39.255'),
  600. array('202.122.64.0','202.122.95.255'),
  601. array('202.122.112.0','202.122.119.255'),
  602. array('202.122.128.0','202.122.128.255'),
  603. array('202.123.96.0','202.123.111.255'),
  604. array('202.124.24.0','202.124.27.255'),
  605. array('202.125.176.0','202.125.191.255'),
  606. array('202.127.0.0','202.127.7.255'),
  607. array('202.127.12.0','202.127.15.255'),
  608. array('202.127.16.0','202.127.31.255'),
  609. array('202.127.40.0','202.127.47.255'),
  610. array('202.127.48.0','202.127.63.255'),
  611. array('202.127.112.0','202.127.127.255'),
  612. array('202.127.128.0','202.127.159.255'),
  613. array('202.127.160.0','202.127.167.255'),
  614. array('202.127.192.0','202.127.255.255'),
  615. array('202.130.0.0','202.130.31.255'),
  616. array('202.130.224.0','202.130.255.255'),
  617. array('202.131.16.0','202.131.23.255'),
  618. array('202.131.48.0','202.131.63.255'),
  619. array('202.131.208.0','202.131.223.255'),
  620. array('202.136.48.0','202.136.63.255'),
  621. array('202.136.208.0','202.136.223.255'),
  622. array('202.136.224.0','202.136.239.255'),
  623. array('202.136.252.0','202.136.255.255'),
  624. array('202.141.160.0','202.141.191.255'),
  625. array('202.142.16.0','202.142.31.255'),
  626. array('202.143.16.0','202.143.31.255'),
  627. array('202.148.96.0','202.148.127.255'),
  628. array('202.149.160.0','202.149.191.255'),
  629. array('202.149.224.0','202.149.255.255'),
  630. array('202.150.16.0','202.150.31.255'),
  631. array('202.152.176.0','202.152.191.255'),
  632. array('202.153.48.0','202.153.63.255'),
  633. array('202.158.160.0','202.158.191.255'),
  634. array('202.160.176.0','202.160.191.255'),
  635. array('202.164.0.0','202.164.15.255'),
  636. array('202.164.25.0','202.164.25.255'),
  637. array('202.165.96.0','202.165.111.255'),
  638. array('202.165.176.0','202.165.191.255'),
  639. array('202.165.208.0','202.165.223.255'),
  640. array('202.168.160.0','202.168.191.255'),
  641. array('202.170.128.0','202.170.159.255'),
  642. array('202.170.216.0','202.170.223.255'),
  643. array('202.173.8.0','202.173.15.255'),
  644. array('202.173.224.0','202.173.255.255'),
  645. array('202.179.240.0','202.179.255.255'),
  646. array('202.180.128.0','202.180.159.255'),
  647. array('202.181.112.0','202.181.127.255'),
  648. array('202.189.80.0','202.189.95.255'),
  649. array('202.192.0.0','202.207.255.255'),
  650. array('203.18.50.0','203.18.50.255'),
  651. array('203.78.48.0','203.78.63.255'),
  652. array('203.79.0.0','203.79.15.255'),
  653. array('203.80.144.0','203.80.159.255'),
  654. array('203.81.16.0','203.81.31.255'),
  655. array('203.83.56.0','203.83.63.255'),
  656. array('203.86.0.0','203.86.63.255'),
  657. array('203.86.64.0','203.86.95.255'),
  658. array('203.88.32.0','203.88.63.255'),
  659. array('203.88.192.0','203.88.223.255'),
  660. array('203.89.0.0','203.89.3.255'),
  661. array('203.90.0.0','203.90.3.255'),
  662. array('203.90.128.0','203.90.191.255'),
  663. array('203.90.192.0','203.90.223.255'),
  664. array('203.91.32.0','203.91.63.255'),
  665. array('203.91.96.0','203.91.111.255'),
  666. array('203.91.120.0','203.91.127.255'),
  667. array('203.92.0.0','203.92.3.255'),
  668. array('203.92.160.0','203.92.191.255'),
  669. array('203.93.0.0','203.93.255.255'),
  670. array('203.94.0.0','203.94.31.255'),
  671. array('203.95.0.0','203.95.7.255'),
  672. array('203.95.96.0','203.95.127.255'),
  673. array('203.99.16.0','203.99.31.255'),
  674. array('203.99.80.0','203.99.95.255'),
  675. array('203.100.32.0','203.100.47.255'),
  676. array('203.100.80.0','203.100.95.255'),
  677. array('203.100.96.0','203.100.127.255'),
  678. array('203.100.192.0','203.100.207.255'),
  679. array('203.110.160.0','203.110.191.255'),
  680. array('203.114.244.0','203.114.247.255'),
  681. array('203.118.192.0','203.118.223.255'),
  682. array('203.118.248.0','203.118.251.255'),
  683. array('203.119.24.0','203.119.31.255'),
  684. array('203.119.32.0','203.119.35.255'),
  685. array('203.128.32.0','203.128.63.255'),
  686. array('203.128.96.0','203.128.127.255'),
  687. array('203.128.128.0','203.128.159.255'),
  688. array('203.130.32.0','203.130.63.255'),
  689. array('203.132.32.0','203.132.63.255'),
  690. array('203.134.240.0','203.134.247.255'),
  691. array('203.135.96.0','203.135.127.255'),
  692. array('203.135.160.0','203.135.175.255'),
  693. array('203.142.219.0','203.142.219.255'),
  694. array('203.148.0.0','203.148.63.255'),
  695. array('203.152.64.0','203.152.95.255'),
  696. array('203.156.192.0','203.156.255.255'),
  697. array('203.158.16.0','203.158.23.255'),
  698. array('203.161.180.0','203.161.180.255'),
  699. array('203.161.192.0','203.161.223.255'),
  700. array('203.166.160.0','203.166.191.255'),
  701. array('203.171.224.0','203.171.239.255'),
  702. array('203.174.7.0','203.174.7.255'),
  703. array('203.174.96.0','203.174.127.255'),
  704. array('203.175.128.0','203.175.159.255'),
  705. array('203.175.192.0','203.175.255.255'),
  706. array('203.176.168.0','203.176.175.255'),
  707. array('203.184.80.0','203.184.95.255'),
  708. array('203.187.160.0','203.187.191.255'),
  709. array('203.190.96.0','203.190.111.255'),
  710. array('203.191.16.0','203.191.31.255'),
  711. array('203.191.64.0','203.191.127.255'),
  712. array('203.191.144.0','203.191.159.255'),
  713. array('203.192.0.0','203.192.31.255'),
  714. array('203.196.0.0','203.196.7.255'),
  715. array('203.207.64.0','203.207.127.255'),
  716. array('203.207.128.0','203.207.255.255'),
  717. array('203.208.0.0','203.208.15.255'),
  718. array('203.208.16.0','203.208.19.255'),
  719. array('203.208.32.0','203.208.63.255'),
  720. array('203.209.224.0','203.209.255.255'),
  721. array('203.212.0.0','203.212.15.255'),
  722. array('203.212.80.0','203.212.95.255'),
  723. array('203.222.192.0','203.222.207.255'),
  724. array('203.223.0.0','203.223.15.255'),
  725. array('210.2.0.0','210.2.31.255'),
  726. array('210.5.0.0','210.5.31.255'),
  727. array('210.5.128.0','210.5.159.255'),
  728. array('210.12.0.0','210.13.255.255'),
  729. array('210.14.64.0','210.14.95.255'),
  730. array('210.14.112.0','210.14.127.255'),
  731. array('210.14.128.0','210.14.255.255'),
  732. array('210.15.0.0','210.15.127.255'),
  733. array('210.15.128.0','210.15.191.255'),
  734. array('210.16.128.0','210.16.191.255'),
  735. array('210.21.0.0','210.21.255.255'),
  736. array('210.22.0.0','210.22.255.255'),
  737. array('210.23.32.0','210.23.63.255'),
  738. array('210.25.0.0','210.25.255.255'),
  739. array('210.26.0.0','210.27.255.255'),
  740. array('210.28.0.0','210.31.255.255'),
  741. array('210.32.0.0','210.47.255.255'),
  742. array('210.51.0.0','210.51.255.255'),
  743. array('210.52.0.0','210.53.255.255'),
  744. array('210.56.192.0','210.56.223.255'),
  745. array('210.72.0.0','210.75.255.255'),
  746. array('210.76.0.0','210.77.255.255'),
  747. array('210.78.0.0','210.78.255.255'),
  748. array('210.79.64.0','210.79.127.255'),
  749. array('210.79.224.0','210.79.255.255'),
  750. array('210.82.0.0','210.83.255.255'),
  751. array('210.87.128.0','210.87.191.255'),
  752. array('210.185.192.0','210.185.255.255'),
  753. array('210.192.96.0','210.192.127.255'),
  754. array('210.211.0.0','210.211.15.255'),
  755. array('211.64.0.0','211.71.255.255'),
  756. array('211.80.0.0','211.95.255.255'),
  757. array('211.96.0.0','211.103.255.255'),
  758. array('211.136.0.0','211.143.255.255'),
  759. array('211.144.0.0','211.159.255.255'),
  760. array('211.160.0.0','211.167.255.255'),
  761. array('218.0.0.0','218.31.255.255'),
  762. array('218.56.0.0','218.63.255.255'),
  763. array('218.64.0.0','218.95.255.255'),
  764. array('218.96.0.0','218.99.255.255'),
  765. array('218.104.0.0','218.107.255.255'),
  766. array('218.108.0.0','218.109.255.255'),
  767. array('218.185.192.0','218.185.223.255'),
  768. array('218.192.0.0','218.207.255.255'),
  769. array('218.240.0.0','218.247.255.255'),
  770. array('218.249.0.0','218.249.255.255'),
  771. array('219.72.0.0','219.72.255.255'),
  772. array('219.82.0.0','219.82.255.255'),
  773. array('219.128.0.0','219.159.255.255'),
  774. array('219.216.0.0','219.223.255.255'),
  775. array('219.224.0.0','219.239.255.255'),
  776. array('219.242.0.0','219.243.255.255'),
  777. array('219.244.0.0','219.247.255.255'),
  778. array('220.101.192.0','220.101.255.255'),
  779. array('220.112.0.0','220.115.255.255'),
  780. array('220.152.128.0','220.152.255.255'),
  781. array('220.154.0.0','220.155.255.255'),
  782. array('220.160.0.0','220.191.255.255'),
  783. array('220.192.0.0','220.207.255.255'),
  784. array('220.231.0.0','220.231.63.255'),
  785. array('220.231.128.0','220.231.255.255'),
  786. array('220.232.64.0','220.232.127.255'),
  787. array('220.234.0.0','220.234.255.255'),
  788. array('220.242.0.0','220.243.255.255'),
  789. array('220.248.0.0','220.251.255.255'),
  790. array('220.252.0.0','220.252.255.255'),
  791. array('221.0.0.0','221.7.255.255'),
  792. array('221.8.0.0','221.11.255.255'),
  793. array('221.12.0.0','221.12.127.255'),
  794. array('221.12.128.0','221.12.191.255'),
  795. array('221.13.0.0','221.13.255.255'),
  796. array('221.14.0.0','221.15.255.255'),
  797. array('221.122.0.0','221.123.255.255'),
  798. array('221.129.0.0','221.129.255.255'),
  799. array('221.130.0.0','221.131.255.255'),
  800. array('221.133.224.0','221.133.255.255'),
  801. array('221.136.0.0','221.137.255.255'),
  802. array('221.172.0.0','221.175.255.255'),
  803. array('221.176.0.0','221.183.255.255'),
  804. array('221.192.0.0','221.195.255.255'),
  805. array('221.196.0.0','221.197.255.255'),
  806. array('221.198.0.0','221.198.255.255'),
  807. array('221.199.0.0','221.199.127.255'),
  808. array('221.199.128.0','221.199.191.255'),
  809. array('221.199.192.0','221.199.207.255'),
  810. array('221.199.224.0','221.199.255.255'),
  811. array('221.200.0.0','221.207.255.255'),
  812. array('221.208.0.0','221.223.255.255'),
  813. array('221.224.0.0','221.239.255.255'),
  814. array('222.16.0.0','222.31.255.255'),
  815. array('222.32.0.0','222.63.255.255'),
  816. array('222.64.0.0','222.95.255.255'),
  817. array('222.125.0.0','222.125.255.255'),
  818. array('222.126.128.0','222.126.255.255'),
  819. array('222.128.0.0','222.143.255.255'),
  820. array('222.160.0.0','222.163.255.255'),
  821. array('222.168.0.0','222.175.255.255'),
  822. array('222.176.0.0','222.191.255.255'),
  823. array('222.192.0.0','222.223.255.255'),
  824. array('222.240.0.0','222.247.255.255'),
  825. array('222.248.0.0','222.249.255.255'),
  826. array('58.14.0.0','58.15.255.255'),
  827. array('58.16.0.0','58.23.255.255'),
  828. array('58.24.0.0','58.25.255.255'),
  829. array('58.30.0.0','58.31.255.255'),
  830. array('58.32.0.0','58.63.255.255'),
  831. array('58.66.0.0','58.67.255.255'),
  832. array('58.68.128.0','58.68.255.255'),
  833. array('58.82.0.0','58.83.255.255'),
  834. array('58.87.64.0','58.87.127.255'),
  835. array('58.99.128.0','58.99.255.255'),
  836. array('58.100.0.0','58.101.255.255'),
  837. array('58.116.0.0','58.119.255.255'),
  838. array('58.128.0.0','58.135.255.255'),
  839. array('58.144.0.0','58.144.255.255'),
  840. array('58.154.0.0','58.155.255.255'),
  841. array('58.192.0.0','58.223.255.255'),
  842. array('58.240.0.0','58.255.255.255'),
  843. array('59.32.0.0','59.63.255.255'),
  844. array('59.64.0.0','59.79.255.255'),
  845. array('59.80.0.0','59.83.255.255'),
  846. array('59.107.0.0','59.107.255.255'),
  847. array('59.108.0.0','59.111.255.255'),
  848. array('59.151.0.0','59.151.127.255'),
  849. array('59.155.0.0','59.155.255.255'),
  850. array('59.172.0.0','59.175.255.255'),
  851. array('59.191.0.0','59.191.127.255'),
  852. array('59.191.240.0','59.191.255.255'),
  853. array('59.192.0.0','59.255.255.255'),
  854. array('60.0.0.0','60.31.255.255'),
  855. array('60.55.0.0','60.55.255.255'),
  856. array('60.63.0.0','60.63.255.255'),
  857. array('60.160.0.0','60.191.255.255'),
  858. array('60.194.0.0','60.195.255.255'),
  859. array('60.200.0.0','60.207.255.255'),
  860. array('60.208.0.0','60.223.255.255'),
  861. array('60.232.0.0','60.233.255.255'),
  862. array('60.235.0.0','60.235.255.255'),
  863. array('60.245.128.0','60.245.255.255'),
  864. array('60.247.0.0','60.247.255.255'),
  865. array('60.252.0.0','60.252.255.255'),
  866. array('60.253.128.0','60.253.255.255'),
  867. array('60.255.0.0','60.255.255.255'),
  868. array('61.4.64.0','61.4.95.255'),
  869. array('61.4.176.0','61.4.191.255'),
  870. array('61.8.160.0','61.8.175.255'),
  871. array('61.28.0.0','61.28.127.255'),
  872. array('61.29.128.0','61.29.255.255'),
  873. array('61.45.128.0','61.45.191.255'),
  874. array('61.47.128.0','61.47.191.255'),
  875. array('61.48.0.0','61.55.255.255'),
  876. array('61.87.192.0','61.87.255.255'),
  877. array('61.128.0.0','61.191.255.255'),
  878. array('61.232.0.0','61.235.255.255'),
  879. array('61.236.0.0','61.237.255.255'),
  880. array('61.240.0.0','61.243.255.255'),

  881. );


  882. $ip_ary=explode('.',$ip);
  883. $ip=sprintf("%03d",$ip_ary[0]).".".sprintf("%03d",$ip_ary[1]).".".sprintf("%03d",$ip_ary[2]).".".sprintf("%03d",$ip_ary[3]);


  884. foreach($cmip_ary as $value){
  885. $ip_ary=explode('.',$value[0]);

  886. $sip=sprintf("%03d",$ip_ary[0]).".".sprintf("%03d",$ip_ary[1]).".".sprintf("%03d",$ip_ary[2]).".".sprintf("%03d",$ip_ary[3]);

  887. $ip_ary=explode('.',$value[1]);

  888. $eip=sprintf("%03d",$ip_ary[0]).".".sprintf("%03d",$ip_ary[1]).".".sprintf("%03d",$ip_ary[2]).".".sprintf("%03d",$ip_ary[3]);
  889. if($ip>=$sip && $ip<=$eip){
  890. return true;
  891. }
  892. }
  893. return false;
  894. }

  895. //上面为写的函数



  896. //以下为函数使用案例

  897. $ip='110.6.0.1';

  898. if(is_ichinaip($ip)){

  899. echo "中国";

  900. }else{

  901. echo "国外";

  902. }

  903. ?>
复制代码

评分

1

查看全部评分

scckfzx 发表于 2009-11-20 15:53:21 | 显示全部楼层
不错,但是效率太低,但目前也没什么好的办法
回复

使用道具 举报

 楼主| wxiong1984 发表于 2009-11-20 15:54:46 | 显示全部楼层
这个没办法,主要是用于精确定位,靠段位查询的并不精确
回复

使用道具 举报

kingtung 发表于 2009-11-20 16:01:41 | 显示全部楼层
记录下来备用
回复

使用道具 举报

xy100200 发表于 2009-11-20 16:07:14 | 显示全部楼层
恩不能做出 国内省会 判断?
回复

使用道具 举报

yh2o 发表于 2009-11-20 18:20:24 | 显示全部楼层
放哪里啊~~~~~~~~~~~~~~
回复

使用道具 举报

fbean 发表于 2009-11-20 18:42:12 | 显示全部楼层
……我认为直接下载一个IP数据库外接就可以了。每次查询都加载这么大一个数组有点可怕~
回复

使用道具 举报

ゾ芯︵亂ジ 发表于 2009-11-20 21:01:50 | 显示全部楼层
放哪里啊~~~~~~~~~~~~~~
回复

使用道具 举报

纽币 发表于 2009-11-20 21:37:51 | 显示全部楼层
只要该顶的,从不手软
回复

使用道具 举报

joybig 发表于 2009-11-21 11:16:45 | 显示全部楼层
这些数据放到数据库里会更好些吧?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-11-20 01:26 , Processed in 0.032373 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表