tredirect user to results if matlab computations are complete - cosmo - front and backend for Markov-Chain Monte Carlo inversion of cosmogenic nuclide concentrations
(HTM) git clone git://src.adamsgaard.dk/cosmo
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 0526774704a7cb67178cc6ade3d015bd9ec5a28d
(DIR) parent 00142444d1e4e8ec926f07b0a59cd566b6f3d57a
(HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Tue, 29 Sep 2015 14:38:49 +0200
redirect user to results if matlab computations are complete
Diffstat:
M index.php | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
---
(DIR) diff --git a/index.php b/index.php
t@@ -32,6 +32,20 @@
<?php
if (isset($_GET['wait_id']) && !empty($_GET['wait_id'])) {
+
+ // read status file contents
+ if (!$statusfile = fopen("/home/adc/cosmo/input/status_" . $_GET['wait_id'], "r")) {
+ echo("Error! Sample data not found.");
+ }
+
+ $status = fgets($statusfile);
+ fclose($statusfile);
+
+ // redirect to results page if computations are complete
+ if (strcmp($status, "Computations complete") == 0) {
+ header("Location: /index.php?results_id=" . $_GET['wait_id']);
+ }
+
// refresh the page every 5 seconds while computations are running
?>
<meta http-equiv="refresh" content="5" >
t@@ -85,12 +99,7 @@ if (isset($_GET['wait_id']) && !empty($_GET['wait_id'])) {
<div class="row center">
<h4 class="header col s12">
<?php
- if (!$statusfile = fopen("/home/adc/cosmo/input/status_" . $_GET['wait_id'], "r")) {
- echo("Error! Sample data not found.");
- }
-
- echo fgets($statusfile);
- fclose($statusfile);
+ echo $status;
?>
</h4>
</div>