Exemple #1
0
// 允许的类型
$sid = isset($_GET["sid"]) ? $_GET["sid"] : NULL;
$type = isset($_GET["type"]) ? $_GET["type"] : NULL;
$top = isset($_GET["top"]) ? intval($_GET["top"]) : 10;
if ($sid == NULL || $type == NULL) {
    json_out(0, "sid or type couldn't be NULL.");
}
if (!in_array($type, $type_allow)) {
    json_out(0, "Type is invalid.");
}
$pmxHost = new pmxHost();
if (!$pmxHost->isExistSaltID($sid)) {
    json_out(0, "sid is non-existent.");
}
if ($type == "executed") {
    $hostExecutedLogs = $pmxHost->getExecutedLogs($sid);
    if (!count($hostExecutedLogs) > 0) {
        json_out(1, "", "<p><center>Empty</center></p>");
    }
    $html = "";
    $index = 0;
    foreach ($hostExecutedLogs as $hostExecutedLogs_item) {
        if ($index >= $top) {
            break;
        }
        $index++;
        $resp = json_decode($hostExecutedLogs_item['resp'], TRUE);
        $resp_data = "";
        if (count($resp) > 0) {
            foreach ($resp as $resp_index => $resp_item) {
                $resp_data = $resp_data . "<p><span class=\"name\">" . esc_html($resp_index) . " : </span>" . esc_html($resp_item) . "</p>";