aboutsummaryrefslogtreecommitdiffstats
path: root/toj/pmod/pmod_test/pmod_test.php
diff options
context:
space:
mode:
authorpzread <netfirewall@gmail.com>2013-03-01 22:30:00 +0800
committerpzread <netfirewall@gmail.com>2013-03-01 22:30:00 +0800
commit56688ed6d0b18f68ac8ddd82c4944c5d2777d20a (patch)
treebb943e164f82b4a826f1d9ce253bfabf912c0004 /toj/pmod/pmod_test/pmod_test.php
parent69d7b55a1c9d3100d42b9c91ab995de44b13d73b (diff)
downloadtaiwan-online-judge-56688ed6d0b18f68ac8ddd82c4944c5d2777d20a.tar
taiwan-online-judge-56688ed6d0b18f68ac8ddd82c4944c5d2777d20a.tar.gz
taiwan-online-judge-56688ed6d0b18f68ac8ddd82c4944c5d2777d20a.tar.bz2
taiwan-online-judge-56688ed6d0b18f68ac8ddd82c4944c5d2777d20a.tar.lz
taiwan-online-judge-56688ed6d0b18f68ac8ddd82c4944c5d2777d20a.tar.xz
taiwan-online-judge-56688ed6d0b18f68ac8ddd82c4944c5d2777d20a.tar.zst
taiwan-online-judge-56688ed6d0b18f68ac8ddd82c4944c5d2777d20a.zip
Taiwan Online Judge Alpha 1
Diffstat (limited to 'toj/pmod/pmod_test/pmod_test.php')
-rwxr-xr-xtoj/pmod/pmod_test/pmod_test.php42
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
+)));
+?>