Fix myway_timeliness_route
--- a/include/common-request.inc.php
+++ b/include/common-request.inc.php
@@ -51,6 +51,9 @@
if (isset($_REQUEST['routeDestination'])) {
$routeDestination = urldecode(filter_var($_REQUEST['routeDestination'], FILTER_SANITIZE_ENCODED));
}
+if (isset($_REQUEST['routename'])) {
+ $routename = urldecode(filter_var($_REQUEST['routename'], FILTER_SANITIZE_ENCODED));
+}
if (isset($_REQUEST['stopcode'])) {
$stopcode = filter_var($_REQUEST['stopcode'], FILTER_SANITIZE_STRING);
}
--- a/myway/myway_timeliness_route.json.php
+++ b/myway/myway_timeliness_route.json.php
@@ -21,12 +21,12 @@
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
?>
{
-"label": "<?php echo $_REQUEST['routeid']; ?>",
+"label": "<?php echo $routename; ?>",
"data": <?php
-$query = "select * from myway_timingdeltas where route_name = :route_name AND abs(timing_delta) < 2*(select stddev(timing_delta) from myway_timingdeltas) order by stop_sequence;";
+$query = "select * from myway_timingdeltas where route_name = :route_name
+AND abs(timing_delta) < 2*(select stddev(timing_delta) from myway_timingdeltas) order by stop_sequence;";
$query = $conn->prepare($query);
-$_REQUEST['routeid'].=" ";
-$query->bindParam(':route_name', $_REQUEST['routeid'], PDO::PARAM_STR);
+$query->bindParam(':route_name', $routename, PDO::PARAM_STR);
$query->execute();
if (!$query) {
@@ -39,3 +39,4 @@
echo "[" . implode(",", $points) . "]";
?>
}
+
--- a/myway/myway_timeliness_route.php
+++ b/myway/myway_timeliness_route.php
@@ -22,7 +22,7 @@
<script language="javascript" type="text/javascript" src="../js/flot/jquery.flot.js"></script>
<form method="get" action="">
- <select id="routeid" name="routeid">
+ <select id="routename" name="routename">
<?php
$query = "select distinct route_name from myway_timingdeltas order by route_name";
$query = $conn->prepare($query);
@@ -59,12 +59,12 @@
// fetch one series, adding to what we got
var alreadyFetched = {};
- $("#routeid").change(function () {
+ $("#routename").change(function () {
var select = $(this);
// find the URL in the link right next to us
// var dataurl = button.siblings('a').attr('href');
- var dataurl = "myway_timeliness_route.json.php?routeid=" + select.val();
+ var dataurl = "myway_timeliness_route.json.php?routename=" + select.val();
// then fetch the data with jQuery
function onDataReceived(series) {
// extract the first coordinate pair so you can see that