tdo not check if status file exists, chmod 777 - 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 5cece23f596126d9bd52a102d1d73cade1354fe2
 (DIR) parent f45b414b4573ef33ca7c470b91ac52049b10d841
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Tue, 29 Sep 2015 11:21:32 +0200
       
       do not check if status file exists, chmod 777
       
       Diffstat:
         M index.php                           |       3 +--
         M uploadhistory.php                   |      44 ++++++++-----------------------
       
       2 files changed, 12 insertions(+), 35 deletions(-)
       ---
 (DIR) diff --git a/index.php b/index.php
       t@@ -85,8 +85,7 @@ if (isset($_GET['wait_id']) && !empty($_GET['wait_id'])) {
                <div class="row center">
                    <h2 class="header col s12 orange">Inversion status: 
        <?php
       -    //if (!$statusfile = fopen("/home/adc/cosmo/input/status_" . $_GET['wait_id'], "r")) {
       -    if (!$statusfile = fopen("/var/www/html/output/status_" . $_GET['wait_id'], "r")) {
       +    if (!$statusfile = fopen("/home/adc/cosmo/input/status_" . $_GET['wait_id'], "r")) {
                echo("Error! Sample data not found.");
            }
        
 (DIR) diff --git a/uploadhistory.php b/uploadhistory.php
       t@@ -157,21 +157,12 @@ if (is_writable($outputfile)) {
                die("The php server could not open $outputfile.");
            }
        
       -    // write header to file
       -    /*foreach ($fieldnames as $fieldname) {
       -        if (fwrite($handle, addslashes($fieldname) . "\t") === false) {
       -            die("The php server could not write $fieldname to $outputfile.");
       -        }
       -    }
       -    fwrite($handle, "\n");*/
       -
            // write values to file
            foreach ($fieldnames as $fieldname) {
                if (fwrite($handle, addslashes($_POST[$fieldname]) . "\t") === false) {
                    die("The php server could not write $fieldname to $outputfile.");
                }
            }
       -    //fwrite($handle, "\n");
        
        } else {
            die("The php server output file $outputfile is not writable");
       t@@ -182,38 +173,25 @@ if (!chmod($outputfile, 0777)) {
            die("The php server could not set proper permissions for $outputfile.");
        }
        
       -//$data = addslashes($_POST['sample_id']) . '\t';
       -//$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);
       -
        // Create inversion status output file
       -//$statusfile = ("/home/adc/cosmo/input/status_" . $id);
       -$statusfile = ("/var/www/html/output/status_" . $id);
       -if (is_writable($statusfile)) {
       -    if (!$handle = fopen($statusfile, 'w')) {
       -        die("The php server could not open $statusfile.");
       -    }
       -
       -    // write status to file
       -    if (fwrite($handle, "Queued") === false) {
       -        die("The php server could not write the status to $statusfile.");
       -    }
       +$statusfile = ("/home/adc/cosmo/input/status_" . $id);
       +if (!$handle = fopen($statusfile, 'w')) {
       +    die("The php server could not open $statusfile.");
       +}
        
       -} else {
       -    die("The php server output file $statusfile is not writable");
       +// write status to file
       +if (fwrite($handle, "Queued") === false) {
       +    die("The php server could not write the status to $statusfile.");
        }
        
       +// change permissions of status file
       +if (!chmod($statusfile, 0777)) {
       +    die("The php server could not set proper permissions for $statusfile.");
       +}
        
        
        // Finally redirect user after processing uploaded data. This header function 
        // call must be before any output!
       -//header("Location: /~ad/cosmo");
        header("Location: /index.php?wait_id=" . $id);
        
        ?>