$res = q($sql); $result = array(); if ($res) { while($row = mysqli_fetch_array($res, MYSQL_ASSOC)){ $result[] = $row; } } */ if (!ob_start("ob_gzhandler")) { ob_start(); } if (empty($q)) { header('Content-Type: application/json'); if (!empty($id)) { $result[0]['story'] = tell_story($result[0], $_GET); } else { unset($row['status']); unset($row['type_desc']); unset($row['comment']); } echo json_encode($result); exit; } else { foreach ($result as $data) { if (preg_match("/{$q}/", $data['name'])) { echo $data['name'] . "\n"; } } } function tell_story($d, $p = array())
list($st, $info) = userid(); if ($id !== 'ALL') { if ($st === true) { $result[0]['info'] = $info; } // 補上高度資料 if ($result[0]['ele'] == 0) { $twDEM_path = "../db/DEM/twdtm_asterV2_30m.tif"; $ele = get_elev($twDEM_path, $result[0]['y'], $result[0]['x'], 1); if ($ele > -1000) { $result[0]['ele'] = $ele; } else { unset($result[0]['ele']); } } $result[0]['story'] = tell_story($result[0]); } else { } // 載入哪些點? foreach ($result as $row) { unset($row['coord']); // 已登入 if ($st === true) { if (is_admin()) { $rows[] = $row; } else { if ($row['owner'] == $info || $row['owner'] == 0) { $rows[] = $row; } } } else {