tremove redundant html code. write to tmp file - 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 1365bbc8d20b267d0e2acd8bbecd134adccebb43
 (DIR) parent 707f186854c0f0c165536a7d9d87ab7f97010194
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Mon, 17 Aug 2015 16:24:28 +0200
       
       remove redundant html code. write to tmp file
       
       Diffstat:
         M uploadhistory.php                   |      29 +++++++++++++++++------------
       
       1 file changed, 17 insertions(+), 12 deletions(-)
       ---
 (DIR) diff --git a/uploadhistory.php b/uploadhistory.php
       t@@ -1,17 +1,22 @@
        <?php
        // write form data to file
        if (isset($_POST['sample_id'])) {
       -    echo 'sample_id set';
       +    $data = $_POST['sample_id'] . '\t';
       +    $tmpfile = tempnam('/tmp', 'cosmo_');
       +    $returnstatus = file_put_contents($tmpfile, $data);
       +
       +    if ($returnstatus === false) {
       +        die('There was an error writing to the output file: ' . $tmpfile);
       +    }
       +
       +
       +    // delete temporary file
       +    //unlink($tmpfile);
       +} else {
       +    die('Invalid post data sent');
        }
       +
       +// redirect user after processing uploaded data, before any output!
       +header("Location: /cosmo");
       +
        ?>
       -<!DOCTYPE html>
       -<!--<html lang="en" ng-app="cosmoApp">-->
       -<html lang="en">
       -    <head>
       -        <meta http-equiv="refresh" content="0; url=/cosmo" />
       -    </head>
       -    <body>
       -    <p>Click <a href="/">here</a> if your browser doesn't automatically forward 
       -    you</p>
       -    </body>
       -</html>