Mercurial > hg > webaudioevaluationtool
annotate php/pseudo.php @ 3120:53d701288da5
Create new php config to allow saves to be stored outside of web scope
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Wed, 18 Jul 2018 16:47:07 +0100 |
parents | 76cffc7ecdee |
children | edd536f01e4b |
rev | line source |
---|---|
nicholas@2224 | 1 <?php |
nicholas@3114 | 2 header('Access-Control-Allow-Origin: *'); |
nicholas@3114 | 3 header("Content-type: text/xml"); |
nicholas@3114 | 4 header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); |
nicholas@3114 | 5 header("Cache-Control: post-check=0, pre-check=0", false); |
nicholas@3114 | 6 header("Pragma: no-cache"); |
nicholas@2224 | 7 |
nicholas@3114 | 8 if (isset($_GET["prefix"]) == FALSE) { |
nicholas@3116 | 9 $prefix = ""; |
nicholas@3114 | 10 } else { |
nicholas@3114 | 11 $prefix = $_GET["prefix"]; |
nicholas@3114 | 12 } |
nicholas@2224 | 13 |
nicholas@3114 | 14 if (isset($_GET["dir"]) == FALSE) { |
nicholas@3117 | 15 $dir = ""; |
nicholas@3114 | 16 } else { |
nicholas@3117 | 17 $dir = $_GET["dir"]; |
nicholas@3114 | 18 } |
nicholas@3120 | 19 $saveLocation = getSaveLocation(); |
nicholas@3120 | 20 $files = glob($saveLocation . $prefix . '*.xml'); |
nicholas@3114 | 21 $numsaves = 0; |
nicholas@3114 | 22 if ( $files !== false ) |
nicholas@3114 | 23 { |
nicholas@3114 | 24 $numsaves = count( $files ); |
nicholas@3114 | 25 } |
nicholas@3114 | 26 |
nicholas@3120 | 27 $testLocation = getTestLocation(); |
nicholas@3120 | 28 $files = glob($testLocation . $dir . '*.xml'); |
nicholas@3114 | 29 $numtests = 0; |
nicholas@3114 | 30 |
nicholas@3114 | 31 if ( $numtests !== false ) |
nicholas@3114 | 32 { |
nicholas@3114 | 33 $numtests = count( $files ); |
nicholas@3114 | 34 } |
nicholas@3114 | 35 |
nicholas@3114 | 36 $testID = ($numsaves % $numtests); |
nicholas@3114 | 37 readfile($files[$testID]); |
nicholas@2457 | 38 ?> |