/home/desid573/public_html/tollster
NameSizeModeActions
coder/-0755rm
geometry-library/-0755rm
lib/-0755rm
src/-0755rm
vendor/-0755rm
11.php280820644editdlrm
21.php7330644editdlrm
a_index.php292430644editdlrm
credentials.json3180644editdlrm
encoder.php26620644editdlrm
endFlag.png6660644editdlrm
error_log1510301880644editdlrm
google_log_api.php90200644editdlrm
google_service.php8870644editdlrm
inFlag.png3450644editdlrm
keyGen.php3240644editdlrm
login_api.php7520644editdlrm
outFlag.png5150644editdlrm
playconsole.php30810644editdlrm
startFlag.png6790644editdlrm
tollster-48ab6e372c8b.json23030644editdlrm
tollster-274e90e11b50.p1224790644editdlrm
Edit: /home/desid573/public_html/tollster/encoder.php (2662B)
points = array(); } /** * Add a point * * @param float $lat : lattitude * @param float $lng : longitude */ function addPoint($lat, $lng) { if (empty($this->points)) { $this->points[] = array('lat' => $lat, 'lng' => $lng); $this->encoded = $this->encodeValue($lat) . $this->encodeValue($lng); } else { $n = count($this->points); $prev_p = $this->points[$n-1]; $this->points[] = array('lat' => $lat, 'lng' => $lng); $this->encoded .= $this->encodeValue($lat-$prev_p['x']) . $this->encodeValue($lng-$prev_p['y']); } } /** * Return the encoded string generated from the points * * @return string */ function encodedString() { return $this->encoded; } /** * Encode a value following Google Maps API v3 algorithm * * @param type $value * @return type */ function encodeValue($value) { $encoded = ""; $value = round($value * 100000); $r = ($value < 0) ? ~($value << 1) : ($value << 1); while ($r >= 0x20) { $val = (0x20|($r & 0x1f)) + 63; $encoded .= chr($val); $r >>= 5; } $lastVal = $r + 63; $encoded .= chr($lastVal); return $encoded; } /** * Decode an encoded polyline string to an array of points * * @param type $value * @return type */ static public function decodeValue($value) { $index = 0; $points = array(); $lat = 0; $lng = 0; while ($index < strlen($value)) { $b; $shift = 0; $result = 0; do { $b = ord(substr($value, $index++, 1)) - 63; $result |= ($b & 0x1f) << $shift; $shift += 5; } while ($b > 31); $dlat = (($result & 1) ? ~($result >> 1) : ($result >> 1)); $lat += $dlat; $shift = 0; $result = 0; do { $b = ord(substr($value, $index++, 1)) - 63; $result |= ($b & 0x1f) << $shift; $shift += 5; } while ($b > 31); $dlng = (($result & 1) ? ~($result >> 1) : ($result >> 1)); $lng += $dlng; $points[] = array('lat' => $lat/100000, 'lng' => $lng/100000); } return $points; } }