Здравстуйте. Хочу сделать аналог http://foobar.ru/ip.php?ip=66.249.95.255 Код определения города по IP уже есть, осталось сделать отметку города на карте как на том сайте. Может есть уже у кого подобные наработки. Буду очень благодарен за помощь. Вот код определения городов по IP PHP: <?php echo <<<html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" /> <title>Untitled Document</title> </head> <body> <img src="map.jpg" width="585" height="310"> <form name="ip" method="post" target="_top" action="" /> IP <input name="ip" type="text" id="input" title="ip" maxlength="20" value="" /> <input name="action" type="hidden" value="run" /> <input name="" type="submit" id="sitemap" title="ok" value="ok" /><br /> <small>пример: 127.0.0.1 </small> </form> <br /> html; function _time() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } $start_time = _time(); if ($_POST['action']=='run') { if ($_POST['ip']!="") { $IP=strip_tags(substr($_POST['ip'],0,20)); echo "ip: \t $IP<br>"; if (preg_match_all("!^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$!si", $IP, $match)) { $bits['a']=implode($match[1]); $bits['b']=implode($match[2]); $bits['c']=implode($match[3]); $bits['d']=implode($match[4]); } $error = 0; if (!($bits['a'] >= '0' and $bits['a'] <= '255')){$error=1;} if (!($bits['b'] >= '0' and $bits['b'] <= '255')){$error=1;} if (!($bits['c'] >= '0' and $bits['c'] <= '255')){$error=1;} if (!($bits['d'] >= '0' and $bits['d'] <= '255')){$error=1;} if ($error == 0) { $ADDRESS = $bits['a']*256*256*256+$bits['b']*256*256+$bits['c']*256+$bits['d']; $master_fale='cidr_ru_master_index.db'; $master_record=file($master_fale); $master_index=0; foreach($master_record as $key=>$master_new_record) { $new_record=trim($new_record); list($start,$stop,$inetnum,$country,$city,$region,$district,$status,$slave,$n_slave) = preg_split('!\t!', $master_new_record); $master[$master_index] =array( start => $start, stop => $stop, inetnum => $inetnum, country => $country, city=>$city, region=>$region, district=>$district, status => $status, slave => $slave, n_slave => $n_slave ); $master_index++; } foreach($master as $key=>$new_master) { if ($ADDRESS>=$new_master['start'] && $ADDRESS<=$new_master['stop']) {$NEW_ADDRESS_0=$new_master;} } if ($NEW_ADDRESS_0!="") { $block_0 = $NEW_ADDRESS_0['inetnum']; $country_0 = $NEW_ADDRESS_0['country']; $city_0 = $NEW_ADDRESS_0['city']; $region_0 = $NEW_ADDRESS_0['region']; $district_0 = $NEW_ADDRESS_0['district']; $status_0 = $NEW_ADDRESS_0['status']; $block_0= "Block:\t".$block_0."<br>\n". "Country: \t".$country_0."<br>\n". "City: \t".$city_0."<br>\n". "Region: \t".$region_0."<br>\n". "District: \t".$district_0."<br>\n". "Status: \t".$status_0."<br><br>\n"; } else {echo"No RIPE-region. Enter another IP-address.<br>\n";$NEW_ADDRESS_0['slave']=-1;} if ($NEW_ADDRESS_0['slave']!=-1) { $slave_fale='cidr_ru_slave_index.db'; $slave_record=file ($slave_fale); $slave_index=0; $min=$NEW_ADDRESS_0['slave']; $max=$min+$NEW_ADDRESS_0['n_slave']; while($min<$max) { $slave_record[$min]=trim($slave_record[$min]); list($start,$stop,$inetnum,$country,$city,$region,$district,$status,$rest) = preg_split('!\t!', $slave_record[$min]); $_slave[$slave_index]=array( start => $start, stop => $stop, inetnum => $inetnum, country => $country, city=>$city,region=>$region, district=>$district, status=>$status ); $slave_index++; $min++; } foreach($_slave as $key=>$new_slave) { if ($ADDRESS>=$new_slave['start'] && $ADDRESS<=$new_slave['stop']) {$NEW_ADDRESS_1=$new_slave;} } $block_1 = $NEW_ADDRESS_1['inetnum']; $country_1 = $NEW_ADDRESS_1['country']; $city_1 = $NEW_ADDRESS_1['city']; $region_1 = $NEW_ADDRESS_1['region']; $district_1 = $NEW_ADDRESS_1['district']; $status_1 = $NEW_ADDRESS_1['status']; $block_1="Block:\t".$block_1."<br>\n". "Country: \t".$country_1."<br>\n". "City: \t".$city_1."<br>\n". "Region: \t".$region_1."<br>\n". "District: \t".$district_1."<br>\n". "Status: \t".$status_1."<br>\n"; } if(!empty($NEW_ADDRESS_1['inetnum'])) {echo $block_1;} else {echo $block_0;} echo '<br>время поиска - '. round(_time()-$start_time, 3); } else {echo"Illegal IP-address: <font color=\"red\">$IP.</font> Enter another IP-address<br>";} } else{echo "Вы забыли ввести IP...";} } echo "\n\t</body> </html>";?> Базу данных диапазонов IP брал на http://ipgeobase.ru/cgi-bin/Archive.cgi
На гугле нефиг делать. Там в стандартные функции входить нахождение точки по координатам. Почитай API документацию у них. А на картинке - 180 градусов на 360 градусов. Делай пропорцию на пиксели и ставь точку относительно пропорций. Должно быть так. Кстати, у них на картинке широта и долгота перепутаны. Просто нарисованы в неправильных местах.