コード例 #1
0
function Query()
{
    $MyPage = CurrentPageName();
    $freeweb = new freeweb($_GET["servername"]);
    $page = CurrentPageName();
    $tpl = new templates();
    $hash = $freeweb->LimitByIp_list();
    if ($_POST["query"] != null) {
        $_POST["query"] = "*{$_POST["query"]}*";
        $_POST["query"] = str_replace(".", "\\.", $_POST["query"]);
        $_POST["query"] = str_replace("**", "*", $_POST["query"]);
        $_POST["query"] = str_replace("**", "*", $_POST["query"]);
        $_POST["query"] = str_replace("*", ".*?", $_POST["query"]);
    }
    $page = 1;
    $COUNT_ROWS = count($hash);
    if ($COUNT_ROWS == 0) {
        $data['page'] = $page;
        $data['total'] = 0;
        $data['rows'] = array();
        echo json_encode($data);
        return;
    }
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    $_POST["query"] = trim($_POST["query"]);
    $total = $COUNT_ROWS;
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    while (list($num, $ligne) = each($hash)) {
        if ($ligne == null) {
            continue;
        }
        if ($_POST["query"] != null) {
            if (!preg_match("#{$_POST["query"]}#", $ligne)) {
                continue;
            }
        }
        $added = null;
        $id = md5($ligne);
        $delete = imgtootltip("delete-24.png", "{delete}", "AuthIpDel('{$ligne}','{$id}')");
        $jscat = "<a href=\"javascript:blur();\" \n\t\tOnClick=\"javascript:Loadjs('squid.categorize.php?www={$ligne["pattern"]}',true);\"\n\t\tstyle='font-size:14px;text-decoration:underline'>";
        $data['rows'][] = array('id' => $id, 'cell' => array("\n\t\t<img src='img/folder-network-32.png'>", "<span style='font-size:18px'>{$ligne}</a></span>", $delete));
    }
    echo json_encode($data);
}
コード例 #2
0
function authip_list()
{
    $freeweb = new freeweb($_GET["servername"]);
    $page = CurrentPageName();
    $tpl = new templates();
    $hash = $freeweb->LimitByIp_list();
    $html = "\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t<th>&nbsp;</th>\n\t<th>{ipaddr}</th>\n\t<th>&nbsp;</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    if (is_array($hash)) {
        while (list($num, $ligne) = each($hash)) {
            if ($ligne == null) {
                continue;
            }
            if ($classtr == "oddRow") {
                $classtr = null;
            } else {
                $classtr = "oddRow";
            }
            $html = $html . "\n\t\t\t<tr class={$classtr}>\n\t\t\t<td width=1%><img src='img/folder-network-32.png'></td>\n\t\t\t<td nowrap><strong style='font-size:14px'>{$ligne}</strong></td>\n\t\t\t<td width=1%>" . imgtootltip("delete-32.png", "{delete}", "AuthIpDel('{$ligne}')") . "</td>\n\t\t\t</tr>\n\t\t\t";
        }
    }
    $html = $html . "</table>\n\t\t<script>\n\t\tfunction AuthIpDel(ip){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('authip-del',ip);\n\t\t\t\tXHR.appendData('servername','{$_GET["servername"]}');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_AuthIpAdd);\n\t\t\t\n\t\t}\t\t\n\t\t</script>\n\t\t";
    echo $tpl->_ENGINE_parse_body($html);
}