Mercurial > hg > webaudioevaluationtool
annotate pseudo.php @ 1856:96b83aa64be3
Actually the previous commit was broken. This contains a working and more elegant way of checking for the input file length. If the input file is empty, no error is triggered.
author | Giulio Moro <giuliomoro@users.noreply.github.com> |
---|---|
date | Tue, 23 Feb 2016 14:39:06 +0000 |
parents | d9b9f707f862 |
children |
rev | line source |
---|---|
nickjillings@1315 | 1 <?php |
nickjillings@1315 | 2 header('Access-Control-Allow-Origin: *'); |
nickjillings@1315 | 3 header("Content-type: text/xml"); |
nickjillings@1315 | 4 $files = glob('saves/' . '*.xml'); |
nickjillings@1315 | 5 $numsaves = 0; |
nickjillings@1315 | 6 if ( $files !== false ) |
nickjillings@1315 | 7 { |
nickjillings@1315 | 8 $numsaves = count( $files ); |
nickjillings@1315 | 9 } |
nickjillings@1315 | 10 |
nickjillings@1315 | 11 $files = glob('pseudo/' . '*.xml'); |
nickjillings@1315 | 12 $numtests = 0; |
nickjillings@1315 | 13 if ( $numtests !== false ) |
nickjillings@1315 | 14 { |
nickjillings@1315 | 15 $numtests = count( $files ); |
nickjillings@1315 | 16 } |
nickjillings@1315 | 17 |
nickjillings@1315 | 18 $testID = ($numsaves % $numtests)-1; |
nickjillings@1315 | 19 |
nickjillings@1315 | 20 readfile($files[$testID]); |
nickjillings@1315 | 21 ?> |