Path : /var/www/html/main/ap/statistic/
File Upload :
Current File : /var/www/html/main/ap/statistic/markers.php

<?php
session_start();

include('../../connDB.php');

if($_GET['nu']==""){
  function parseToXML($htmlStr){
    $xmlStr = str_replace('<','&lt;',$htmlStr);
    $xmlStr = str_replace('>','&gt;',$xmlStr);
    $xmlStr = str_replace('"','&quot;',$xmlStr);
    $xmlStr = str_replace("'",'&#39;',$xmlStr);
    $xmlStr = str_replace("&",'&amp;',$xmlStr);
    return $xmlStr;
  }

  if(empty($_GET['date'])){
    $_GET['date'] = date('Ymd');
  }else{
    $_GET['date'] = $_GET['date'];
  }

  $sql = "select * from ap_counters where xday like '".$_GET['date']."%' and (xlat>0 and xlng>0) order by id desc";
  $query = mysqli_query($conn,$sql);
  $num_rows = mysqli_num_rows($query);

  header("Content-type: text/xml");
  echo '<markers>';
  $i = 0;
  while ($rows = mysqli_fetch_array($query)){
    $i++;
    echo '<marker ';
    echo 'name="ผู้ใช้บริการ จำนวน '.$i.'/'.$num_rows.'" ';
    echo 'address="" ';
    echo 'lat="' . $rows['xlat'] . '" ';
    echo 'lng="' . $rows['xlng'] . '" ';
    echo 'type="People" ';
    echo '/>';
  }
  echo '<marker name="ตำแหน่งของคุณ" address="" lat="'.$_COOKIE['lat'].'" lng="'.$_COOKIE['lng'].'" type="You"/>';
  echo '</markers>';
}

mysqli_close($conn);
?>