Posted By

stancox on 08/09/10


Tagged

location geoip


Versions (?)

Проверяет находится ли страна в СНГ использует maxmind


 / Published in: PHP
 

URL: http://www.maxmind.com/app/ip-location

  1. include('geoip/geoipcity.inc'); include("geoip/geoipregionvars.php");
  2.  
  3. $gi = geoip_open("geoip/GeoLiteCity.dat",GEOIP_STANDARD);
  4. $record = geoip_record_by_addr($gi, getip());
  5. $country_array = array('AZ', 'AM', 'BY', 'GE', 'KZ', 'KG', 'MD', 'RU', 'TJ', 'TY', 'TM', 'UZ', 'UA');
  6. $client_country = $record->country_code;
  7. geoip_close($gi);
  8.  
  9. if(in_array($client_country, $country_array))
  10. {
  11. echo "Yes";
  12. }

Report this snippet  

You need to login to post a comment.