示例#1
0
文件: index.php 项目: Git-Host/proxy
        $output->show_login_form($error);
        break;
    case INTERNAL_ERROR:
        $message = "Internal error. Try setting proxy_hostname in config.php manually.";
        $status = 500;
        break;
    case FORBIDDEN_HOSTNAME:
        $message = "Access to that website is not allowed.";
        $status = 403;
        break;
    case LOOPBACK:
        $message = "Loopback connection not allowed.";
        $status = 508;
        break;
    case LOCAL_FILE:
        $output->show_local_file($page, $_CONFIG["local_files"]);
        break;
    case 403:
        $output->http_error($result);
        break;
    case 405:
    case 500:
        $output->http_error($result);
        $output->show_url_form();
        break;
    default:
        $message = "Something went wrong (" . $result . ").";
}
if ($message !== null) {
    $output->show_url_form($bootstrap->user_input, $message, $status);
}
示例#2
0
$message = null;
$status = null;
switch ($result) {
    case CONNECTION_ERROR:
        $message = "Connection error.";
        break;
    case NO_USER_INPUT:
        $page = ltrim($_SERVER["REQUEST_URI"], "/");
        if ($page == "") {
            $output->show_url_form();
        } else {
            if (in_array($page, $proxy_pages)) {
                $output->show_page($page);
            } else {
                if (in_array($page, array_keys($local_files))) {
                    $output->show_local_file($page, $local_files);
                } else {
                    $output->http_error(404);
                }
            }
        }
        break;
    case LOGIN_REQUIRED:
        $error = isset($_POST["access_code"]) ? "Invalid login." : null;
        $output->show_login_form($error);
        break;
    case INTERNAL_ERROR:
        $message = "Internal error. Try setting proxy_hostname in config.php manually.";
        $status = 500;
        break;
    case FORBIDDEN_HOSTNAME: