Пример #1
0
function get_rdisc6()
{
    global $_dev, $_cfg;
    $start = microtime(TRUE);
    $tmp = parseVars(sendCommand("{$_cfg["app_dir"]}configure-ipv6.sh {$_dev}"));
    $end = microtime(TRUE);
    $tmp["rdisc6_time"] = ($end - $start) * 1000;
    return $tmp;
}
Пример #2
0
function runner()
{
    global $onlypost, $qs, $config;
    if ($config['appserver'] == 'ionic') {
        if (isset($_SERVER['HTTP_ORIGIN'])) {
            header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
            header('Access-Control-Allow-Credentials: true');
            header('Access-Control-Max-Age: 86400');
            // cache for 1 day
        }
        if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
            if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) {
                header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
            }
            if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) {
                header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
                exit(0);
            }
        }
        $payload = file_get_contents("php://input");
        $data = json_decode($payload);
        run($data->getting, $data->action);
    } else {
        if ($_POST) {
            $vars = parseVars($_POST);
            if (in_array($vars['action'], $onlypost)) {
                run($vars['getting'], $vars['action']);
            } else {
                echo 'This is a D\'oh';
            }
        }
        if ($_SERVER['REQUEST_METHOD'] == 'GET') {
            if ($qs == '') {
                run('', 'hello');
            } else {
                if ($_GET) {
                    $vars = parseVars($_GET);
                    if (!in_array($vars['action'], $onlypost)) {
                        run($vars['getting'], $vars['action']);
                    } else {
                        echo 'This is a D\'oh';
                    }
                }
            }
        }
    }
}