diff options
Diffstat (limited to 'toj/pmod/pmod_test/pmod_test.php')
-rwxr-xr-x | toj/pmod/pmod_test/pmod_test.php | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/toj/pmod/pmod_test/pmod_test.php b/toj/pmod/pmod_test/pmod_test.php new file mode 100755 index 0000000..27eecf2 --- /dev/null +++ b/toj/pmod/pmod_test/pmod_test.php @@ -0,0 +1,42 @@ +<?php +require_once('../../php/problem.inc.php'); + +const PMODNAME = 'pmod_test'; + +$proid = json_decode($_POST['proid']); +if(gettype($proid) != 'integer' || $proid < 1){ + exit('Eproid'); +} + +$sqlc = db_connect(); +if(!problem::is_available($sqlc,$proid)){ + exit('Epermission'); +} + +$pro = problem::get($sqlc, $proid); +if($pro->pmodname != PMODNAME) + exit('Ewrong_pmod'); + +db_close($sqlc); + +$prodir = '/srv/http/toj/center/pro/'.$proid.'/'; + +$fd = fopen($prodir.'setting','r'); +while($line = fgets($fd)){ + if($line[0] == '='){ + break; + } +} +$set = ''; +while(($line = fgets($fd))){ + $set = $set.$line; +} +fclose($fd); + +$content = file_get_contents($prodir.'public/content'); + +echo(json_encode(array( + 'set' => json_decode($set), + 'content' => $content +))); +?> |