Beispiel #1
0
<?php 
}
?>
  </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'];
Beispiel #2
0
 public function lock()
 {
     $s['action'] = "lock";
     httpsocket($this->gds, $s);
 }
Beispiel #3
0
    $p = new DataAccess();
    $sql = "update grader set address='{$_POST['address']}',priority='{$_POST['priority']}',enabled='{$enabled}',memo='{$_POST['memo']}' where grid={$_REQUEST[grid]}";
    $p->dosql($sql);
    提示("修改评测机 {$_POST['address']} 成功!", 取路径("submit/graderlist.php"));
}
if ($_REQUEST['action'] == 'start') {
    $p = new DataAccess();
    $sql = "select address from grader where grid={$_GET[grid]}";
    $cnt = $p->dosql($sql);
    $d = $p->rtnrlt(0);
    $s['action'] = "start";
    httpsocket($d['address'], $s);
    if ($s['state'] == "successful") {
        提示("启动评测机 {$_GET[grid]} 成功!", 取路径("submit/graderlist.php"));
    } else {
        异常("启动评测机 {$_GET[grid]} 失败!", 取路径("submit/graderlist.php"));
    }
}
if ($_REQUEST['action'] == 'stop') {
    $p = new DataAccess();
    $sql = "select address from grader where grid={$_GET[grid]}";
    $cnt = $p->dosql($sql);
    $d = $p->rtnrlt(0);
    $s['action'] = "shutdown";
    httpsocket($d['address'], $s);
    if ($s['state'] == "successful") {
        提示("关闭评测机 {$_GET[grid]} 成功!", 取路径("submit/graderlist.php"));
    } else {
        异常("关闭评测机 {$_GET[grid]} 失败!", 取路径("submit/graderlist.php"));
    }
}