--- a/betweenpoint.submit.php
+++ b/betweenpoint.submit.php
@@ -1,76 +1,32 @@
nodes of the first movie.
- * Output the rating scale, too. */
-foreach ($xml->node as $node) {
- $geoPo = geopoEncode((float)$node['lat'],(float)$node['lon']);
- $node['lat'] = (int) ((float)$node['lat']*10000000);
- $node['lon'] = (int) ((float)$node['lon']*10000000);
- echo($node['lat'].",".$node['lon']."=$geoPo
");
- $sql = "INSERT INTO stops (geohash, lat, lng) VALUES('$geoPo','{$node['lat']}','{$node['lon']}')";
+print_r($_REQUEST);
+$reverse=$_REQUEST["reverse"];
+$from=pg_escape_string($_REQUEST["from"]);
+$to=pg_escape_string($_REQUEST["to"]);
+$routes=$_REQUEST["routes"] ;
+$points=$_REQUEST["between_points"];
+ $sql = "INSERT INTO between_stops (fromLocation, toLocation, points, routes) VALUES('$from','$to','$points','$routes')";
$result = pg_query($conn, $sql);
if (!$result) {
echo("Error in SQL query: " . pg_last_error() ."
\n");
}
+ if ($reverse === "on") {
+ $ep = explode(";",$points);
+ $epr = array_reverse($ep);
+ $p = implode(";",$epr).";";
+ $pointsString = substr($p,1);
+$sql = "INSERT INTO between_stops ( toLocation, fromLocation, points, routes) VALUES('$from','$to','$pointsString','$routes')";
+$result = pg_query($conn, $sql);
+ if (!$result) {
+ echo("Error in SQL query: " . pg_last_error() ."
\n");
+ }
+ }
flush();
-}
?>