foreach ($steps as $step) {
                 // Gets the encoded polyline.
                 $encodedPolyline = $step->getEncodedPolyline();
                 $map->addEncodedPolyline($encodedPolyline);
             }
         }
     }
     // end of 1st iteration. found time and distance
 }
 if ($i == 7) {
     $org = array();
     $org = getCoord($finarr[$i]);
     //echo $org[0]['latitude'];
     //echo $org[0]['longitude'];
     $des = array();
     $des = getCoord($finarr[$i + 1]);
     //echo $des[0]['latitude'];
     //echo $des[0]['longitude'];
     $marker3 = new Marker();
     $marker3->setPrefixJavascriptVariable('marker_');
     $marker3->setPosition($org[0]['latitude'], $org[0]['longitude'], true);
     $marker3->setAnimation(Animation::DROP);
     $marker3->setOption('clickable', true);
     $marker3->setOption('flat', true);
     $marker3->setOptions(array('clickable' => true, 'flat' => true));
     $map->addMarker($marker);
     $marker4 = new Marker();
     $marker4->setPrefixJavascriptVariable('marker_two');
     $marker4->setPosition($des[0]['latitude'], $des[0]['longitude'], true);
     $marker4->setAnimation(Animation::DROP);
     $marker4->setOption('clickable', true);
    } else {
        $from = null;
    }
    //get the end date
    if (isset($_GET['to'])) {
        $to = $_GET['to'];
    } else {
        $to = null;
    }
    //echo "Data: site = $site, crack id = $cid, from = $from, to = $to <Br><Br>";
    $gndmeas = getGndMeas($site = $site, $cid = $cid, $from = $from, $to = $to, $mysql_host, $mysql_database, $mysql_user, $mysql_password);
    echo $gndmeas;
}
if (isset($_GET['coord'])) {
    //echo "coord exists<Br/>";
    $a = getCoord($mysql_host, $mysql_database, $mysql_user, $mysql_password);
    echo $a;
}
if (isset($_GET['alert'])) {
    //echo "accel exists <Br/>";
    $q = $_GET['q'];
    $site = $_GET['site'];
    $nid = (int) $_GET['nid'];
    getAlert($site, $mysql_host, $mysql_database, $mysql_user, $mysql_password);
}
if (isset($_GET['sitecolumn'])) {
    //echo "sitecolumn getter exists <Br/>";
    if (isset($_GET['sidlatest']) && !empty($_GET['sidlatest'])) {
        $sid = (int) $_GET['sidlatest'];
    } else {
        $sid = 0;