Example #1
0
            $day = strtotime("2012-11-01");
        } else {
            echo "Last entry in " . $stream . ": " . $row_["last_entry_date"] . "<br>" . PHP_EOL;
            $tmp_day = strtotime($row_["last_entry_date"]);
            if ($tmp_day <= strtotime($row_["last_entry_date"])) {
                // find the earliest day from streams where data is present
                $day = strtotime($row_["last_entry_date"]) + 3600 * 23;
                // add 1 day
                if ($day >= time()) {
                    $stop = true;
                }
            }
        }
    }
    if (!isset($stop)) {
        getDataSince($day, $eggid, $identifier);
    }
    echo "<hr>";
}
/*
	This is the function that actually parses Lanuv's website and extracts the information.
	Calls insertIntoDatabase() to insert the data.

	$day format: md (example: november 1st is 1101)
	$identifier: LANUV station identifier
	$cosmid: 	 unique database id for that station
*/
function getDataSince($timestamp, $eggid, $identifier)
{
    global $chemical_weights;
    // database date format: Y-m-d\TH:i:s
Example #2
0
             $data = array("msg" => "worked");
             $status = 200;
         } else {
             $data = array("msg" => "Data empty");
             $status = 550;
         }
     } else {
         $data = array("msg" => $msg);
         $status = 551;
     }
     break;
 case "getDataSince":
     $sid = (int) $_REQUEST['sid'];
     $eid = (int) $_REQUEST['eid'];
     $since = (int) $_REQUEST['since'];
     if ($update = getDataSince($eid, $sid, $since)) {
         $status = 200;
         $data = array('sid' => $sid, 'update' => $update);
     }
     break;
 case "uploadImageToExperiment":
     $file = isset($_FILES['image']);
     $eid = isset($_POST['eid']) ? $_POST['eid'] : null;
     $img_name = isset($_POST['img_name']) ? $_POST['img_name'] : null;
     $img_desc = isset($_POST['img_description']) ? $_POST['img_description'] : null;
     $session_key = isset($_POST['session_key']) ? $_POST['session_key'] : null;
     if ($eid == null) {
         $data = array("msg" => "Missing experiment parameter");
         $status = 551;
     } else {
         if ($img_name == null) {