<?php

  $host 
"indirizzo_host";
  
$user "nome_utente";
  
$password "password_db";
  
$databs "nome_db";
  
$tab_mappa "nome_tabella";
  
$api_key "google_maps_api";
        
  
$connessione=mysql_connect($host,$user,$password);

    if(!
$connessione) {
        
      echo 
"ERRORE! Impossibile Collegarsi al Database.";
          
      exit(
0);
          
    }
        
  
$db=mysql_select_db($databs);

    
$query "SELECT * FROM " $tab_mappa ";";
    
$result mysql_query$query$connessione );
      if ( 
mysql_error() != ) {
              
        die( 
'Errore query: ' mysql_error() );
        
      }

      
$row mysql_fetch_array $result );
              
      
$restot "
      <input type='hidden' id='nome' value='" 
stripslashes html_entity_decode htmlspecialchars $row["nome"], ENT_QUOTES'UTF-8' ) ) ) . "'>
      <input type='hidden' id='indirizzo' value='" 
stripslashes html_entity_decode htmlspecialchars $row["indirizzo"], ENT_QUOTES'UTF-8' ) ) ) . "'>
      <input type='hidden' id='descrizione' value='" 
stripslashes html_entity_decode htmlspecialchars $row['descrizione'], ENT_QUOTES'UTF-8' ) ) ) . "'>
      <input type='hidden' id='immagine' value='" 
stripslashes html_entity_decode htmlspecialchars $row['logo'], ENT_QUOTES'UTF-8' ) ) ) . "'>
      <input type='hidden' id='latit' value='" 
stripslashes html_entity_decode htmlspecialchars $row['latit'], ENT_QUOTES'UTF-8' ) ) ) . "'>
      <input type='hidden' id='longi' value='" 
stripslashes html_entity_decode htmlspecialchars $row['long'], ENT_QUOTES'UTF-8' ) ) ) . "'>";

      
$names $row['nome'];

  
mysql_close $connessione );

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title><?php echo stripslashes html_entity_decode htmlspecialchars $namesENT_QUOTES'UTF-8' ) ) ); ?></title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php echo $api_key ?>" type="text/javascript"></script>
    <script type="text/javascript">
      //<![CDATA[
            
      // Zoom sul luogo da visualizzare
      var zoom = 16;
            
      // Debug delle Coordinate
      var debug = false; 
            
      function load(lat,log,nam,indy,desc,logo) {
            
      if (debug) document.getElementById("debug").style.display="block";
            
        if (GBrowserIsCompatible()) {

          var map = new GMap2(document.getElementById("map"));
                    
          // Inserimento dei controlli per lo Zoom e la Visualizzazione per Strada, Satellitare e Ibrida
          map.addControl(new GSmallMapControl());
          map.addControl(new GMapTypeControl());
          
          if (debug) {
          
          GEvent.addListener(map, "moveend", function() {
          
          var center = map.getCenter();
          
          document.getElementById("debug").innerHTML = center.toString();
          
          });
          
          GEvent.addListener(map, "click", function(marker, point) {
          
          if (point)
          
          document.getElementById("debug").innerHTML = point.toString();
          
          });
          
          }

            // Crea il marker
            map.setCenter(new GLatLng(lat,log), zoom);
                
            var point = new GLatLng(lat,log);
                                
            //map.setCenter(point, zoom);
            var marker = new GMarker(point);
                                
            // Testo nel Fumetto con le caratteristiche prelevate dal DataBase
            var messaggio = "<img src=\"" + logo + "\" border=\"0\" align=\"left\"> <font style=\"font-family:Verdana; font-size:11px;\"><strong>" + nam + "</strong><br />" + indy + "<br /><br />" + desc + "</font>";
                                
            GEvent.addListener(marker, "click", function() {
                
            // Visualizzazione del Fumetto
            marker.openInfoWindowHtml(messaggio); })
                                
            map.addOverlay(marker);

        }
                
      }
            
      //]]>
    </script>
  </head>
  <body onload="load(document.getElementById('latit').value, document.getElementById('longi').value, document.getElementById('nome').value, document.getElementById('indirizzo').value, document.getElementById('descrizione').value, document.getElementById('immagine').value)" onunload="GUnload()">
    
    <?php echo $restot?>
        
    <div id="map" style="width: 500px; height: 300px"></div>
        
    <div id="debug" style="display:none"></div>
        
  </body>
</html>