salve a tutti,

sto facendo un progetto basato sulla geolocalizzazione, e ho trovato un esempio di file php che fà proprio al caso mio e vorrei modificarlo per adattarlo alle mie esigenze.
il problema è che sono alle prime armi con questo linguaggio (io vengo da c++) e vorrei sapere se c'è qualche buona anima che ha voglia di mettersi e commentare le righe del codice per spiegarmi cosa fanno esattamente.
praticamente delle coordinate geografiche vengono mandate da un microcontrollore (Arduino) alla pagina con una azione HTTP e sulla pagina mi compare una mappa che mostra il punto in cui si trovano le coordinate grazie a una API di google maps.

il codice php è il seguente:




in allegato ci sono i file necessari.
Codice PHP:
<?php      if (!empty($_GET['latitude']) && !empty($_GET['longitude']) &&         !empty($_GET['time']) && !empty($_GET['satellites']) &&         !empty($_GET['speedOTG']) && !empty($_GET['course'])) {          function getParameter($par$default null){             if (isset($_GET[$par]) && strlen($_GET[$par])) return $_GET[$par];             elseif (isset($_POST[$par]) && strlen($_POST[$par]))                  return $_POST[$par];             else return $default;         }          $file 'gps.txt';         $lat getParameter("latitude");         $lon getParameter("longitude");         $time getParameter("time");         $sat getParameter("satellites");         $speed getParameter("speedOTG");         $course getParameter("course");         $person $lat.",".$lon.",".$time.",".$sat.",".$speed.",".$course."\n";                  echo "             DATA:\n             Latitude: ".$lat."\n             Longitude: ".$lon."\n             Time: ".$time."\n             Satellites: ".$sat."\n             Speed OTG: ".$speed."\n             Course: ".$course;          if (!file_put_contents($file$personFILE_APPEND LOCK_EX))             echo "\n\t Error saving Data\n";         else echo "\n\t Data Save\n";     }     else {  ?>  <!DOCTYPE html> <html>      <head>            <script language="JavaScript" type="text/javascript" src="jquery-1.10.1.min.js"></script>                  <script src="http://maps.googleapis.com/maps/api/js?key=your_key&sensor=false"></script>            <script type="text/javascript">         var myCenter=new google.maps.LatLng(41.669578,-0.907495);         var marker;         var map;         var mapProp;          function initialize()         {             mapProp = {               center:myCenter,               zoom:15,               mapTypeId:google.maps.MapTypeId.ROADMAP               };             setInterval('mark()',5000);         }          function mark()         {             map=new google.maps.Map(document.getElementById("googleMap"),mapProp);             var file = "gps.txt";             $.get(file, function(txt) {                  var lines = txt.split("\n");                 for (var i=0;i<lines.length;i++){                     console.log(lines[i]);                     var words=lines[i].split(",");                     if ((words[0]!="")&&(words[1]!=""))                     {                         marker=new google.maps.Marker({                               position:new google.maps.LatLng(words[0],words[1]),                               });                         marker.setMap(map);                         map.setCenter(new google.maps.LatLng(words[0],words[1]));                         document.getElementById('sat').innerHTML=words[3];                         document.getElementById('speed').innerHTML=words[4];                         document.getElementById('course').innerHTML=words[5];                     }                 }                 marker.setAnimation(google.maps.Animation.BOUNCE);             });          }          google.maps.event.addDomListener(window, 'load', initialize);     </script> </head>  <body>     <?php         echo '                        <div>             <center>
                 [b] SIM908 GPS position DEMO [/b]

                 <div id="superior" style="width:800px;border:1px solid">                     <table style="width:100%">                         <tr>                             <td>Time</td>                             <td>Satellites</td>                             <td>Speed OTG</td>                             <td>Course</td>                         </tr>                         <tr>                             <td id="time">'
date("Y M d - H:m") .'</td>                             <td id="sat"></td>                             <td id="speed"></td>                             <td id="course"></td>                         </tr>                 </table>                 </div>                 

                 <div id="googleMap" style="width:800px;height:700px;"></div>             </center>         </div>'
;     ?> </body> </html>  <?php ?>