include("geoip.inc"); // includes the geoip.inc $gi = geoip_open('GeoIP.dat',GEOIP_STANDARD); // loads the database $country = geoip_country_code_by_addr($gi,$_SERVER['REMOTE_ADDR']); // determines the country from current ip address and outputs 2 letter country code, for United States it's US for example