*note: I don't post much, so all my links are still blatant spam attempts, and as such are not permitted. Please replace (HTTP) with the appropriate stuff, and (COM) with the dot and the com required for use. Ok, so after speaking with a few people in PM and seeing a few requests here for scripts like this, I've decided to post a simple php script to handle all of your geo-targeting needs. First, you're going to need some files for this all to work. If you don't have PHP/Apache/etc installed, you'll have to figure that out and then come back...same applies if you don't know how to set file permissions, copy, use ftp, wipe, type, or use a mouse. Go to Code: (HTTP)geolite.maxmind(COM)/download/geoip/api/php/ Once you're there, download these files: geoip.inc geoipcity.inc geoipregionvars.php Change the files geoip.inc and geoipcity.inc to .php...so you should end up with geoip.php and geoipcity.php when you're done. Next, download the GeoLiteCity.dat file from here: Code: (HTTP)geolite.maxmind(COM)/download/geoip/database/GeoLiteCity.dat.gz ok, now create a new file and call it iplocate.php, then place it with all of the files you just downloaded, into a new folder called geo. You should now have a folder named 'geo' that contains geoip.php, geoipcity.php, geoipregionvars.php, iplocate.php, and GeoLiteCity.dat Now, open iplocate.php (it should be a blank file at the moment) in your favorite php editor, and insert the following: Code: <?php // grab the scripts we're going to need... require_once("geoip.php"); require_once("geoipcity.php"); require_once("geoipregionvars.php"); // get user's ip, and look it up in the database... $ip_address = trim($_SERVER['REMOTE_ADDR']); $gi = geoip_open("GeoLiteCity.dat", GEOIP_STANDARD); $record = geoip_record_by_addr($gi, $ip_address); // assign the most common vars here... $user_state = trim($GEOIP_REGION_NAME[$record->country_code][$record->region]); $user_city = trim($record->city); $user_zip = trim($record->postal_code); //print $record->country_code . " " . $record->country_code3 . " " . $record->country_name . "\n"; //print $record->latitude . "\n"; //print $record->longitude . "\n"; //print $record->dma_code . "\n"; //print $record->area_code . "\n"; geoip_close($gi); ?> You may need to change one thing...you might have to put the full path to the GeoLiteCity.dat file in where it currently says geoip_open("GeoLiteCity.dat" If so, then you will have to change it to geoip_open("/home/myacct/public_html/geo/GeoLiteCity.dat" or something like that...you should be able to figure that out... then save, close, and you're ready...now upload this folder to wherever it is that you need to use it at. to use it in your web pages, first of all make sure your page is a .php page, as obviously .html pages won't work unless you've modified your php.ini and if you know how to do that, then you're not reading this. So make sure it's a .php page, then add the following code to it, near the top if possible... Code: <?php require_once("geo/iplocate.php"); ?> Now, as long as you've included that little piece of code near the top of your page, you can put this wherever you want to see the city, state, etc in the page: Code: <? php echo $user_state; // shows the user's state ?> <? php echo $user_city; // shows the user's city ?> <?php echo $user_zip; // shows the user's zip code ?> have fun!