コード例 #1
0
ファイル: easyrule.php プロジェクト: NewEraCracker/pfsense
$pgtitle = gettext("Firewall: EasyRule");
require_once "guiconfig.inc";
require_once "easyrule.inc";
require_once "filter.inc";
require_once "shaper.inc";
$retval = 0;
$message = "";
$specialsrcdst = explode(" ", "any pptp pppoe l2tp openvpn");
if ($_GET && isset($_GET['action'])) {
    switch ($_GET['action']) {
        case 'block':
            /* Check that we have a valid host */
            easyrule_parse_block($_GET['int'], $_GET['src'], $_GET['ipproto']);
            break;
        case 'pass':
            easyrule_parse_pass($_GET['int'], $_GET['proto'], $_GET['src'], $_GET['dst'], $_GET['dstport'], $_GET['ipproto']);
            break;
    }
}
if (stristr($retval, "error") == true) {
    $message = $retval;
}
include "head.inc";
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td>
<?php 
if ($input_errors) {
    print_input_errors($input_errors);
}
コード例 #2
0
ファイル: diag_logs_filter.php プロジェクト: noikiy/core-2
    } else {
        $response = array('resolve_ip' => $ip, 'resolve_text' => gettext("Cannot resolve"));
    }
    echo json_encode(str_replace("\\", "\\\\", $response));
    // single escape chars can break JSON decode
    exit;
}
if (isset($_POST['easyrule'])) {
    $response = array("status" => "unknown");
    switch ($_POST['easyrule']) {
        case 'block':
            easyrule_parse_block($_POST['intf'], $_POST['srcip'], $_POST['ipproto']);
            $response["status"] = "block";
            break;
        case 'pass':
            easyrule_parse_pass($_POST['intf'], $_POST['proto'], $_POST['srcip'], $_POST['dstip'], $_POST['dstport'], $_POST['ipproto']);
            $response["status"] = "pass";
            break;
    }
    echo json_encode(str_replace("\\", "\\\\", $response));
    exit;
}
function getGETPOSTsettingvalue($settingname, $default)
{
    $settingvalue = $default;
    if (isset($_GET[$settingname])) {
        $settingvalue = $_GET[$settingname];
    }
    if (isset($_POST[$settingname])) {
        $settingvalue = $_POST[$settingname];
    }