IP 2 Location allows ip lookups using php. You can offer this nice ip lookup service that includes google maps, and if you want even street view.
So find ips and search them with this ip lookup and geocoding with mapping server

IP 2 Location is a neat little tool that I’ve seen on a few sites but no “real” here’s how to make it happen guide.  It’s actually incredible to think that these are actually just large databases that are used to convert IP addresses to geographic locations.   I found such a database from Max Mind called GeoCityLite.

Whatever course you decide upon, there is always someone to tell you that you are wrong. There are always difficulties arising which tempt you to believe that your critics are right. To map out a course of action and follow it to an end requires courage.
-Ralph Waldo Emerson

GeoCityDB
I’m using the city version but you can just as easily use the country version which is smaller and faster.  For this example either should work.    The following code assumes you know how to use LOAD DATA INFILE and are using the csv->mysql database information on their site.
Here is a sample I used:

mysql> LOAD DATA LOCAL INFILE "//GeoLiteCity-Location.csv" INTO TABLE geo_blocks FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY "\n";

After the database is loaded the rest is just using examples from Google Maps API. I used the following code directly from the code given when applying for a Google Map API Key. I modified it to include both the function to use the database and the functions to use the JSON from Google. Check it out below.

= startblock AND
	'.$ipnum.' <= endblock';

$rs = mysql_query($sql);
$locid = mysql_result($rs,0);
$sql = 'SELECT lat,longitude FROM geo_blocks WHERE locid = '.$locid;
$rs = mysql_query($sql);
$line = mysql_fetch_array($rs);
?>


  
    

    
    
  
  

I hope you enjoy this bit of code and I will have a working example of in action soon. IP 2 Location doesn’t have to be hard and this example with PHP and Google maps proves it.

You want a lesson? I’ll give you a lesson. How about a geography lesson? My father’s from Puerto Rico. My mother’s from El Salvador. And neither one of those is Mexico.
-Jennifer Esposito