switch ($action) {
    case "getCSV":
        $uuid = $_GET['uuid'];
        $tryfile = PREDS_PATH . $uuid . "/" . FLIGHT_CSV;
        if (!file_exists($tryfile)) {
            return false;
        }
        $fh = fopen($tryfile, "r");
        $data = array();
        while (!feof($fh)) {
            $line = trim(fgets($fh));
            array_push($data, $line);
        }
        $returned = json_encode($data);
        echo $returned;
        $stats->counting('habhub.predictor.php.get_csv');
        break;
    case "JSONexists":
        $uuid = $_GET['uuid'];
        if (file_exists(PREDS_PATH . $uuid . "/" . PROGRESS_JSON)) {
            echo true;
        } else {
            echo false;
        }
        break;
    case "locationSave":
        $lat = $_POST['req_lat'];
        $lon = $_POST['req_lon'];
        $alt = $_POST['req_alt'];
        $locname = $_POST['req_name'];
        if ($locname == '' || !LOCATION_SAVE_ENABLE) {
/*
 * CUSF Landing Prediction Version 2
 * http://www.cuspaceflight.co.uk
 *
 * Jon Sowman 2010
 * jon@hexoc.com
 * http://www.hexoc.com
 *
 * http://github.com/jonsowman/cusf-standalone-predictor
 *
 */
require_once "includes/config.inc.php";
require_once "includes/functions.inc.php";
$stats = new StatsD();
$stats->counting('habhub.predictor.php.hits');
// Get the time for pre-populating the form
$time = time() + 3600;
?>
<html>
<head>
<title>CUSF Landing Predictor 2.0</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="http://www.google.com/jsapi?key=<?php 
echo GMAPS_API_KEY;
?>
">
</script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<link href="css/pred.css" type="text/css" rel="stylesheet" />
<link href="css/calc.css" type="text/css" rel="stylesheet" />