public function compile() { $s['action'] = "compile"; $s['pname'] = $this->info['pname']; $s['uid'] = $this->info['uid']; $s['language'] = $this->info['language']; $s['src'] = $this->info['pname'] . '.' . langnumtostr($this->info['language']); $fp = fopen($this->srcname, "r"); $s['code'] = rfile($fp); fclose($fp); if ($this->info['mode'] == "test") { unlink($this->srcname); } chdir($this->odir); $this->cmds = $tmp = httpsocket($this->gds, $s); $this->state = array_decode($tmp); $this->compilemessage = $this->state['msg']; if ($this->state['compilesucc']) { return 1; } else { return 0; } }
<td rowspan='3'> <?php if ($uid == $d['uid'] || 有此权限('测试题目')) { ?> <form method="post" action="../submit/run.php" class='form-inline'> <input name="pid" type="hidden" id="pid" value="<?php echo $d['pid']; ?> " /> <input name="sid" type="hidden" id="sid" value="<?php echo $d['sid']; ?> " /> <input type="hidden" name="rejudge" value="1"> <input type="hidden" name="lang" value="<?php echo langnumtostr($d['lang']); ?> "> <select name='judger' id='judger' > <option value=0 selected=selected>自动选择</option> <?php $sql = "select grid,address,memo from grader where enabled=1 order by priority desc"; $cnt = $q->dosql($sql); for ($i = 0; $i < $cnt; $i++) { $e = $q->rtnrlt($i); echo "<option value={$e['grid']} >{$e['memo']}</option>"; } ?> </select> <button type="submit" class='btn'>重新评测</button>