I really can't provide the link (wish I could) as the site is not set
to public yet.
I have a page with two maps that each have 15 markers but for some
reason only the markers from the first map show up. The other map
displays everything else except the markers.
Here is the code:
require_once("Net/GeoIP.php");
//Connecting to Mysql Database
$database = mysql_connect("localhost", "acid","acid") or die
(mysql_error());
mysql_select_db("snort",$database) or die("Database connect
problem") ;
//Getting List of Top 15 Source IPs
$query=" SELECT DISTINCT INET_NTOA(ip_src) AS Source_IP FROM
acid_event WHERE timestamp>now()- INTERVAL 160080 MINUTE GROUP BY
ip_src ORDER BY Source_IP DESC LIMIT 0, 15";
//Results from above query are stored here
$result=mysql_query($query);
//Creating Net_GeoIP instance so they can be used to get IPs Country,
City and other location values
$geoip = Net_GeoIP::getInstance("./GeoIP.dat");
$geoipcity = Net_GeoIP::getInstance("./GeoLiteCity.dat");
//Start of Lookup Location process for each IP Address:
$ip0=mysql_result($result,0,"Source_IP");
$city0 = $geoipcity->lookupLocation($ip0);
$ip1=mysql_result($result,1,"Source_IP");
$city1 = $geoipcity->lookupLocation($ip1);
$ip2=mysql_result($result,2,"Source_IP");
$city2 = $geoipcity->lookupLocation($ip2);
$ip3=mysql_result($result,3,"Source_IP");
$city3 = $geoipcity->lookupLocation($ip3);
$ip4=mysql_result($result,4,"Source_IP");
$city4 = $geoipcity->lookupLocation($ip4);
$ip5=mysql_result($result,5,"Source_IP");
$city5 = $geoipcity->lookupLocation($ip5);
$ip6=mysql_result($result,6,"Source_IP");
$city6 = $geoipcity->lookupLocation($ip6);
$ip7=mysql_result($result,7,"Source_IP");
$city7 = $geoipcity->lookupLocation($ip7);
$ip8=mysql_result($result,8,"Source_IP");
$city8 = $geoipcity->lookupLocation($ip8);
$ip9=mysql_result($result,9,"Source_IP");
$city9 = $geoipcity->lookupLocation($ip9);
$ip10=mysql_result($result,10,"Source_IP");
$city10 = $geoipcity->lookupLocation($ip10);
$ip11=mysql_result($result,11,"Source_IP");
$city11 = $geoipcity->lookupLocation($ip11);
$ip12=mysql_result($result,12,"Source_IP");
$city12 = $geoipcity->lookupLocation($ip12);
$ip13=mysql_result($result,13,"Source_IP");
$city13 = $geoipcity->lookupLocation($ip13);
$ip14=mysql_result($result,14,"Source_IP");
$city14 = $geoipcity->lookupLocation($ip14);
//Getting List of Top 15 Destination IPs
$query="SELECT DISTINCT INET_NTOA(ip_dst) AS Dest_IP FROM acid_event
WHERE timestamp>now()- INTERVAL 160080 MINUTE GROUP BY ip_dst ORDER BY
Dest_IP DESC LIMIT 0, 15";
//Results from above query are stored here
$result=mysql_query($query);
//Creating Net_GeoIP instance so they can be used to get IPs Country,
City and other location values
$geoip2 = Net_GeoIP::getInstance("./GeoIP.dat");
$geoipcity2 = Net_GeoIP::getInstance("./GeoLiteCity.dat");
//Start of Lookup Location process for each of 15 IP Addresses:
$ip0b=mysql_result($result,0,"Dest_IP");
$city0b = $geoipcity2->lookupLocation($ip0b);
$ip1b=mysql_result($result,1,"Dest_IP");
$city1b = $geoipcity2->lookupLocation($ip1b);
$ip2b=mysql_result($result,2,"Dest_IP");
$city2b = $geoipcity2->lookupLocation($ip2b);
$ip3b=mysql_result($result,3,"Dest_IP");
$city3b = $geoipcity2->lookupLocation($ip3b);
$ip4b=mysql_result($result,4,"Dest_IP");
$city4b = $geoipcity2->lookupLocation($ip4b);
$ip5b=mysql_result($result,5,"Dest_IP");
$city5b = $geoipcity2->lookupLocation($ip5b);
$ip6b=mysql_result($result,6,"Dest_IP");
$city6b = $geoipcity2->lookupLocation($ip6b);
$ip7b=mysql_result($result,7,"Dest_IP");
$city7b = $geoipcity2->lookupLocation($ip7b);
$ip8b=mysql_result($result,8,"Dest_IP");
$city8b = $geoipcity2->lookupLocation($ip8b);
$ip9b=mysql_result($result,9,"Dest_IP");
$city9b = $geoipcity2->lookupLocation($ip9b);
$ip10b=mysql_result($result,10,"Dest_IP");
$city10b = $geoipcity2->lookupLocation($ip10b);
$ip11b=mysql_result($result,11,"Dest_IP");
$city11b = $geoipcity2->lookupLocation($ip11b);
$ip12b=mysql_result($result,12,"Dest_IP");
$city12b = $geoipcity2->lookupLocation($ip12b);;
$ip13b=mysql_result($result,13,"Dest_IP");
$city13b = $geoipcity2->lookupLocation($ip13b);
$ip14b=mysql_result($result,14,"Dest_IP");
$city14b = $geoipcity2->lookupLocation($ip14b);
?>
<!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" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="content-type" content="text/html;
charset=utf-8"/>
<title>my ip address with Google Maps</title>
<script src="http://maps.google.com/maps?
file=api&v=2.128e&key=ABQIAAAAuRfCHQ_taKyf20nlq3PH6xR38NGlQqwyHVJYK1wdxE6ie4lnPxSnqGwXKp9sLMiYo9rJoCdRzYGL-
w" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var locator = {
addAddressToMap: function(response) {
//locator.map.clearOverlays();
if (!response || response.Status.code != 200) {
//alert("Sorry, we were unable to
geocode that address");
}
else {
place = response.Placemark[0];
point = new
GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);
marker = new GMarker(point);
locator.map.addOverlay(marker);
//locator.markerOptions.title("A");
//GMarker.getTitle("A");
//marker.openInfoWindowHtml(place.address);
}
},
load: function() {
if (GBrowserIsCompatible()) {
locator.map = new
GMap2(document.getElementById("map"));
locator.map.setMapType(G_NORMAL_MAP);
//try also G_HYBRID_MAP or
just G_SATELLITE_MAP
locator.map.addControl(new
GLargeMapControl());
locator.map.addControl(new
GScaleControl());
locator.map.addControl(new
GMapTypeControl());
//locator.map.addControl(new
GOverviewMapControl());
locator.map.setCenter(new GLatLng(29,
7), 2);
locator.geocoder = new
GClientGeocoder();
locator.geocoder.getLocations("<?php
echo $city0->city; ?
>", locator.addAddressToMap);
locator.geocoder.getLocations("<?php echo $city1->city; ?>",
locator.addAddressToMap);
locator.geocoder.getLocations("<?php echo $city2->city; ?>",
locator.addAddressToMap);
locator.geocoder.getLocations("<?php echo $city3->city; ?>",
locator.addAddressToMap);
locator.geocoder.getLocations("<?php echo $city4->city; ?>",
locator.addAddressToMap);
locator.geocoder.getLocations("<?php echo $city5->city; ?>",
locator.addAddressToMap);
locator.geocoder.getLocations("<?php echo $city6->city; ?>",
locator.addAddressToMap);
locator.geocoder.getLocations("<?php echo $city7->city; ?>",
locator.addAddressToMap);
locator.geocoder.getLocations("<?php echo $city8->city; ?>",
locator.addAddressToMap);
locator.geocoder.getLocations("<?php echo $city9->city; ?>",
locator.addAddressToMap);
locator.geocoder.getLocations("<?php echo $city10->city; ?>",
locator.addAddressToMap);
locator.geocoder.getLocations("<?php echo $city11->city; ?>",
locator.addAddressToMap);
locator.geocoder.getLocations("<?php echo $city12->city; ?>",
locator.addAddressToMap);
locator.geocoder.getLocations("<?php echo $city13->city; ?>",
locator.addAddressToMap);
locator.geocoder.getLocations("<?php echo $city14->city; ?>",
locator.addAddressToMap);
}
}
}
//]]>
</script>
<!--Script below (locator2) is used to create the 1st Google
Map of
Top 15 Destination Addresses-->
<script type="text/javascript">
var locator2 = {
addAddressToMap2: function(response) {
place2 = response.Placemark[0];
point2 = new
GLatLng(place2.Point.coordinates[1],
place2.Point.coordinates[0]);
marker2 = new GMarker(point2);
locator2.map2.addOverlay(marker2);
},
load: function() {
if (GBrowserIsCompatible()) {
locator2.map2 = new
GMap2(document.getElementById("map2"));
locator2.map2.setMapType(G_HYBRID_MAP);
//Try also G_NORMAL_MAP
or G_HYBRID_MAP or just G_SATELLITE_MAP
locator2.map2.addControl(new
GLargeMapControl()); //Zoom in and
out scale in upper left part of the map
locator2.map2.addControl(new
GScaleControl()); // Distance legend
visible in lower left corner
locator2.map2.addControl(new
GMapTypeControl()); //Creates map
type control in upper right corner of the map
locator2.map2.setCenter(new GLatLng(29, 7), 2);
locator2.geocoder2 = new GClientGeocoder();
locator2.geocoder2.getLocations("<?php echo
$city0b->city; ?
>", locator2.addAddressToMap2);
locator2.geocoder2.getLocations("<?php echo
$city1b->city; ?>",
locator2.addAddressToMap2);
locator2.geocoder2.getLocations("<?php echo
$city2b->city; ?>",
locator2.addAddressToMap2);
locator2.geocoder2.getLocations("<?php echo
$city3b->city; ?>",
locator2.addAddressToMap2);
locator2.geocoder2.getLocations("<?php echo
$city4b->city; ?>",
locator2.addAddressToMap2);
locator2.geocoder2.getLocations("<?php echo
$city5b->city; ?>",
locator2.addAddressToMap2);
locator2.geocoder2.getLocations("<?php echo
$city6b->city; ?>",
locator2.addAddressToMap2);
locator2.geocoder2.getLocations("<?php echo
$city7b->city; ?>",
locator2.addAddressToMap2);
locator2.geocoder2.getLocations("<?php echo
$city8b->city; ?>",
locator2.addAddressToMap2);
locator2.geocoder2.getLocations("<?php echo
$city9b->city; ?>",
locator2.addAddressToMap2);
locator2.geocoder2.getLocations("<?php echo
$city10b->city; ?>",
locator2.addAddressToMap2);
locator2.geocoder2.getLocations("<?php echo
$city11b->city; ?>",
locator2.addAddressToMap2);
locator2.geocoder2.getLocations("<?php echo
$city12b->city; ?>",
locator2.addAddressToMap2);
locator2.geocoder2.getLocations("<?php echo
$city13b->city; ?>",
locator2.addAddressToMap2);
locator2.geocoder2.getLocations("<?php echo
$city14b->city; ?>",
locator2.addAddressToMap2);
}
}
}
</script>
<SCRIPT TYPE="text/javascript">
function init()
{
locator.load();
locator2.load();
}
</SCRIPT>
</head>
<body onload="init();" onunload="GUnload();">
<div id="map" style="width:850px;height:460px;"></div> <!-- MAP 1 -->
<div id="map2" style="width:850px;height:460px;"></div> <!-- Map 2-->
</body>
</html>
Thank you for helping me in advance!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---