<?php require_once "stdlib.php"; $query = array_decode($_POST['query']); if (isset($query['action'])) { require "grade.php"; } else { require "welcome.php"; }
function array_decode($array) { foreach ($array as $key => $value) { if (is_array($value)) { $array[$key] = array_decode($value); } else { $array[$key] = base64_decode($value); } } return $array; }
public function run($i) { $s['action'] = "grade"; $s['grade'] = $i; $s['uid'] = $this->info['uid']; $s['pname'] = $this->info['pname']; $s['language'] = $this->info['language']; $s['timelimit'] = $this->info['timelimit']; $s['memorylimit'] = $this->info['memorylimit']; $s['plugin'] = $this->info['plugin']; $this->cmds = $tmp = httpsocket($this->gds, $s); $this->state = array_decode($tmp); $this->nowjudge = $i; $this->exitcode = $this->state['exitcode']; $this->runtime = $this->state['rtime']; $this->memory = $this->state['memory']; $this->avgmemory += $this->memory; $this->totaltime += $this->runtime; $this->noindata = (int) $this->state['noindata']; $this->noansdata = (int) $this->state['noansdata']; }
public function getHistory($date) { $date = strtotime($date) ? strtotime($date) : time(); //get path to the history file of today $year = date('Y', $date); $month = date('m', $date); $day = date('d', $date); $file = 'history/' . $year . '/' . $month . '/' . $day . '.json'; if (!is_file($file)) { return array('no history record found for this date'); } $history = array_decode(json_decode(@file_get_contents($file), true)); return $history; }
} ?> </tr> <?php $LIB->func_socket(); $p = new DataAccess(); $sql = "select * from grader"; $cnt = $p->dosql($sql); for ($i = $st; $i < $cnt; $i++) { $d = $p->rtnrlt($i); $s['action'] = "state"; if ($d['address'] == 'grader') { $d['address'] = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $cfg['dir_root'] . 'grader/'; } $debug = $tmp = httpsocket($d['address'], $s); $tmp = array_decode($tmp); if ($tmp == array()) { $tmp['name'] = "无法连接"; $tmp['state'] = "未知"; $tmp['ver'] = "未知"; $tmp['cnt'] = "未知"; } ?> <tr> <td><?php echo $d['grid']; ?> </td> <td><?php echo $tmp['name']; ?>