function parseTemplate()
{
    if (isset($_GET["verbose"])) {
        $GLOBALS["VERBOSE"] = true;
    }
    include_once dirname(__FILE__) . "/ressources/class.ufdb.microsoft.inc";
    $CATEGORY_SOURCE = null;
    $proto = "http";
    $url = $_GET["url"];
    $cacheid = null;
    $HTTP_X_FORWARDED_FOR = null;
    $HTTP_X_REAL_IP = null;
    if (isset($_GET["category"])) {
        $CATEGORY_SOURCE = $_GET["category"];
    }
    $AS_SSL = false;
    $DisableSquidGuardHTTPCache = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/DisableSquidGuardHTTPCache"));
    if ($GLOBALS["VERBOSE"]) {
        echo "<div style='background-color:white;font-size:22px;color:black'>" . __LINE__ . ": DisableSquidGuardHTTPCache: {$DisableSquidGuardHTTPCache}</div>\n";
    }
    $HTTP_REFERER = null;
    if (isset($_GET["targetgroup"])) {
        $TARGET_GROUP_SOURCE = $_GET["targetgroup"];
        if ($CATEGORY_SOURCE == null) {
            $CATEGORY_SOURCE = $TARGET_GROUP_SOURCE;
        }
    }
    $clientgroup = $_GET["clientgroup"];
    $QUERY_STRING = $_SERVER["QUERY_STRING"];
    if (isset($_SERVER["HTTP_REFERER"])) {
        $HTTP_REFERER = $_SERVER["HTTP_REFERER"];
    }
    $HTTP_REFERER_HOST = hostfrom_url($HTTP_REFERER);
    if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
        $HTTP_X_FORWARDED_FOR = $_SERVER["HTTP_X_FORWARDED_FOR"];
    }
    if (isset($_SERVER["HTTP_X_REAL_IP"])) {
        $HTTP_X_REAL_IP = $_SERVER["HTTP_X_REAL_IP"];
    }
    $URL_HOST = hostfrom_url($url);
    if (isset($_GET["rule-id"])) {
        $ID = $_GET["rule-id"];
    }
    if (isset($_GET["fatalerror"])) {
        $ID = 0;
        $cacheid = "fatalerror";
    }
    if (isset($_GET["loading-database"])) {
        $ID = 0;
        $cacheid = "loading-database";
    }
    if (isset($_SERVER['HTTPS'])) {
        if (strtolower($_SERVER['HTTPS']) == 'on') {
            $proto = "https";
            $AS_SSL = true;
        }
    }
    $time = date("Ymdh");
    if ($AS_SSL) {
        if (!isset($_GET["SquidGuardIPWeb"])) {
            $requested_uri = "https://" . $_SERVER["SERVER_NAME"] . "/" . $_SERVER["REQUEST_URI"];
            $arrayURI = parse_url($requested_uri);
            $requested_hostname = $arrayURI["host"];
        }
    }
    if (preg_match("#&url=(.*?)(&|\$)#", $QUERY_STRING, $re)) {
        $requested_uri = parseTemplate_string_to_url($re[1]);
        $arrayURI = parse_url($requested_uri);
        $requested_hostname = $arrayURI["host"];
    }
    $GLOBALS["BLOCK_KEY_CACHE"] = md5("{$HTTP_X_FORWARDED_FOR}{$HTTP_X_REAL_IP}{$time}{$proto}{$proto}{$TARGET_GROUP_SOURCE}{$clientgroup}{$requested_hostname}{$HTTP_REFERER_HOST}{$URL_HOST}{$ID}{$cacheid}");
    if ($GLOBALS["VERBOSE"]) {
        $DisableSquidGuardHTTPCache = 1;
    }
    if ($DisableSquidGuardHTTPCache == 0) {
        if (is_file("/home/squid/error_page_cache/{$GLOBALS["BLOCK_KEY_CACHE"]}")) {
            if (parseTemplate_file_time_min("/home/squid/error_page_cache/{$GLOBALS["BLOCK_KEY_CACHE"]}") < 10) {
                echo @file_get_contents("/home/squid/error_page_cache/{$GLOBALS["BLOCK_KEY_CACHE"]}");
                return;
            }
        }
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "<div style='background-color:white;font-size:22px;color:black'>" . __LINE__ . ": TARGET_GROUP_SOURCE {$TARGET_GROUP_SOURCE} / {$requested_hostname}</div>\n";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "<div style='background-color:white;font-size:22px;color:black'>" . __LINE__ . ": CATEGORY_SOURCE {$CATEGORY_SOURCE} / {$requested_hostname}</div>\n";
    }
    if ($TARGET_GROUP_SOURCE == "none") {
        $TARGET_GROUP_SOURCE = "{ufdb_none}";
        $EnableSquidGuardSearchCategoryNone = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableSquidGuardSearchCategoryNone"));
        if ($CATEGORY_SOURCE == null) {
            $EnableSquidGuardSearchCategoryNone = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableSquidGuardSearchCategoryNone"));
            if ($EnableSquidGuardSearchCategoryNone == 1) {
                include_once dirname(__FILE__) . "/ressources/class.mysql.catz.inc";
                $catz = new mysql_catz();
                $CATEGORY_SOURCE = $catz->GET_CATEGORIES($requested_hostname);
                if ($CATEGORY_SOURCE == null) {
                    $CATEGORY_SOURCE = "{unknown}";
                }
            }
        }
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "<div style='background-color:white;font-size:22px;color:black'>" . __LINE__ . ": TARGET_GROUP_SOURCE {$TARGET_GROUP_SOURCE} / {$requested_hostname}</div>\n";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "<div style='background-color:white;font-size:22px;color:black'>" . __LINE__ . ": CATEGORY_SOURCE {$CATEGORY_SOURCE} / {$requested_hostname}</div>\n";
    }
    session_start();
    $HTTP_REFERER = null;
    $template_default_file = dirname(__FILE__) . "/ressources/databases/dansguard-template.html";
    include_once dirname(__FILE__) . "/ressources/class.sockets.inc";
    include_once dirname(__FILE__) . "/ressources/class.mysql.inc";
    $sock = new sockets();
    $users = new usersMenus();
    //$q=new mysql_squid_builder();
    $UfdbGuardRedirectCategories = unserialize(base64_decode($sock->GET_INFO("UfdbGuardRedirectCategories")));
    $SquidGuardWebFollowExtensions = $sock->GET_INFO("SquidGuardWebFollowExtensions");
    $SquidGuardServerName = $sock->GET_INFO("SquidGuardServerName");
    $SquidGuardApachePort = $sock->GET_INFO("SquidGuardApachePort");
    $SquidGuardWebUseLocalDatabase = $sock->GET_INFO("SquidGuardWebUseLocalDatabase");
    $SquidGuardWebBlankReferer = intval($sock->GET_INFO("SquidGuardWebBlankReferer"));
    if (!is_numeric($SquidGuardWebFollowExtensions)) {
        $SquidGuardWebFollowExtensions = 1;
    }
    if (!is_numeric($SquidGuardWebUseLocalDatabase)) {
        $SquidGuardWebUseLocalDatabase = 0;
    }
    if ($SquidGuardWebBlankReferer == 1) {
        if ($URL_HOST != $HTTP_REFERER_HOST) {
            $data = "<html><head></head><body></body></html>";
            header("Content-Length: " . strlen($data));
            header("Content-Type: text/html");
            echo $data;
            die;
        }
    }
    $GLOBALS["JS_NO_CACHE"] = true;
    $GLOBALS["JS_HEAD_PREPREND"] = "{$proto}://{$_SERVER["SERVER_NAME"]}:{$_SERVER["SERVER_PORT"]}";
    if ($SquidGuardWebFollowExtensions == 1) {
        if (parseTemplate_extension($_GET["url"])) {
            return;
        }
    }
    if (parseTemplateForcejs($_GET["url"])) {
        parseTemplateLogs("JS detected : For {$_GET["url"]}", __FUNCTION__, __FILE__, __LINE__);
        header("content-type: application/x-javascript");
        echo "// blocked by url filtering\n";
        return true;
        return;
    }
    $defaultjs = "alert('Disabled')";
    $ADD_JS_PACK = false;
    if ($SquidGuardWebUseLocalDatabase == 1) {
        $clientaddr = base64_encode($_GET["clientaddr"]);
        $defaultjs = "s_PopUp('{$GLOBALS["JS_HEAD_PREPREND"]}/" . basename(__FILE__) . "?SquidGuardWebUseLocalDatabase=1&url=" . base64_encode("{$_GET["url"]}") . "&clientaddr={$clientaddr}',640,350)";
        $ADD_JS_PACK = true;
    }
    if ($users->CORP_LICENSE) {
        $LICENSE = 1;
        $FOOTER = null;
    }
    if (!$users->CORP_LICENSE) {
        $LICENSE = 0;
    }
    parseTemplateLogs("{$_GET["clientaddr"]}: Category=`{$CATEGORY_SOURCE}` targetgroup=`{$_GET["targetgroup"]}` LICENSE:{$LICENSE}", __FUNCTION__, __FILE__, __LINE__);
    $CATEGORY_KEY = null;
    $_GET["targetgroup"] = parseTemplate_categoryname($TARGET_GROUP_SOURCE, $LICENSE);
    $_GET["clientgroup"] = parseTemplate_categoryname($_GET["clientgroup"], $LICENSE);
    $_GET["category"] = parseTemplate_categoryname($CATEGORY_SOURCE, $LICENSE);
    $CATEGORY_KEY = parseTemplate_categoryname($CATEGORY_SOURCE, $LICENSE, 1);
    if ($CATEGORY_KEY == null) {
        $CATEGORY_KEY = parseTemplate_categoryname($TARGET_GROUP_SOURCE, $LICENSE, 1);
    }
    $_CATEGORIES_K = $_GET["category"];
    $_RULE_K = $_GET["clientgroup"];
    if ($_CATEGORIES_K == null) {
        $_CATEGORIES_K = $_GET["targetgroup"];
    }
    if ($_RULE_K == null) {
        $_RULE_K = "{web_filtering}";
    }
    $REASONGIVEN = "{web_filtering} {$_CATEGORIES_K}";
    if ($_CATEGORIES_K == "restricted_time") {
        $REASONGIVEN = "{restricted_access}";
    }
    parseTemplateLogs("{$REASONGIVEN}: _CATEGORIES_K=`{$_CATEGORIES_K}` _RULE_K={$_RULE_K}` LICENSE:{$LICENSE}", __FUNCTION__, __FILE__, __LINE__);
    $IpToUid = null;
    //$IpToUid=$q->IpToUid($_GET["clientaddr"]);
    if ($IpToUid != null) {
        $IpToUid = "&nbsp;({$IpToUid})";
    }
    if ($LICENSE == 1) {
        if ($CATEGORY_KEY != null) {
            $RedirectCategory = $UfdbGuardRedirectCategories[$CATEGORY_KEY];
            if ($RedirectCategory["enable"] == 1) {
                if ($RedirectCategory["blank_page"] == 1) {
                    parseTemplateLogs("[{$CATEGORY_KEY}]: blank_page : For {$_GET["url"]}", __FUNCTION__, __FILE__, __LINE__);
                    header("HTTP/1.1 200 OK");
                    die;
                    return;
                }
                if (trim($RedirectCategory["template_data"]) != null) {
                    header('Content-Type: text/html; charset=iso-8859-1');
                    $TemplateErrorFinal = $RedirectCategory["template_data"];
                    return;
                }
            }
        }
    }
    $EnableSquidFilterWhiteListing = $sock->GET_INFO("EnableSquidFilterWhiteListing");
    if ($LICENSE == 1) {
        if (is_numeric($ID)) {
            if ($ID == 0) {
                $ligne["groupname"] = "Default";
            } else {
                $sql = "SELECT groupname FROM webfilter_rules WHERE ID={$ID}";
                $q = new mysql_squid_builder();
                $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
                $ruleName = $ligne["groupname"];
            }
        } else {
            writelogs("ID: not a numeric", __FUNCTION__, __FILE__, __LINE__);
        }
    }
    if (isset($_GET["fatalerror"])) {
        $_GET["clientaddr"] = $_SERVER["REMOTE_ADDR"];
        $_GET["clientname"] = $_SERVER["REMOTE_HOST"];
        $REASONGIVEN = "{webfiltering_issue}";
        $_CATEGORIES_K = "{system_Webfiltering_error}";
        $_RULE_K = "{service_error}";
        $_GET["url"] = $_SERVER['HTTP_REFERER'];
    }
    if (isset($_GET["loading-database"])) {
        $_GET["clientaddr"] = $_SERVER["REMOTE_ADDR"];
        $_GET["clientname"] = $_SERVER["REMOTE_HOST"];
        $REASONGIVEN = "{Webfiltering_maintenance}";
        $_CATEGORIES_K = "{please_wait_reloading_databases}";
        $_RULE_K = "{waiting_service}....";
        $_GET["url"] = $_SERVER['HTTP_REFERER'];
    }
    if (!isset($_SESSION["IPRES"][$_GET["clientaddr"]])) {
        $_SESSION["IPRES"][$_GET["clientaddr"]] = gethostbyaddr($_GET["clientaddr"]);
    }
    if (isset($_GET["source"])) {
        $_GET["clientaddr"] = $_GET["source"];
    }
    if (isset($_GET["user"])) {
        $_GET["clientname"] = $_GET["user"];
    }
    if (isset($_GET["virus"])) {
        $_GET["targetgroup"] = $_GET["virus"];
        $ruleName = null;
    }
    if ($_GET["clientuser"] != null) {
        $_GET["clientname"] = $_GET["clientuser"];
    }
    $ruleName = parseTemplate_categoryname($ruleName, $LICENSE);
    $ARRAY["URL"] = $_GET["url"];
    $ARRAY["IPADDR"] = $_GET["clientaddr"];
    $ARRAY["REASONGIVEN"] = $REASONGIVEN;
    $ARRAY["CATEGORY_KEY"] = $CATEGORY_KEY;
    $ARRAY["RULE_ID"] = $ID;
    $ARRAY["CATEGORY"] = $_CATEGORIES_K;
    $ARRAY["RULE"] = $_RULE_K;
    if ($ruleName != null) {
        $ARRAY["RULE"] = $ruleName;
    }
    $ARRAY["targetgroup"] = $_GET["targetgroup"];
    $ARRAY["IpToUid"] = $IpToUid;
    $ARRAY["clientname"] = $_GET["clientname"];
    $ARRAY["HOST"] = $_SESSION["IPRES"][$_GET["clientaddr"]];
    $GLOBALS["BLOCK_KEY_CACHE"];
    $Content = parseTemplate_build_main($ARRAY);
    @file_put_contents("/home/squid/error_page_cache/{$GLOBALS["BLOCK_KEY_CACHE"]}", $Content);
    echo $Content;
}
function parseTemplate()
{
    session_start();
    $template_default_file = dirname(__FILE__) . "/ressources/databases/dansguard-template.html";
    if (isset($_GET["verbose"])) {
        $GLOBALS["VERBOSE"] = true;
    }
    include_once dirname(__FILE__) . "/ressources/class.sockets.inc";
    include_once dirname(__FILE__) . "/ressources/class.mysql.inc";
    $sock = new sockets();
    $users = new usersMenus();
    //$q=new mysql_squid_builder();
    $UfdbGuardRedirectCategories = unserialize(base64_decode($sock->GET_INFO("UfdbGuardRedirectCategories")));
    $SquidGuardWebFollowExtensions = $sock->GET_INFO("SquidGuardWebFollowExtensions");
    $SquidGuardServerName = $sock->GET_INFO("SquidGuardServerName");
    $SquidGuardApachePort = $sock->GET_INFO("SquidGuardApachePort");
    $SquidGuardWebUseLocalDatabase = $sock->GET_INFO("SquidGuardWebUseLocalDatabase");
    $SquidGuardWebBlankReferer = intval($sock->GET_INFO("SquidGuardWebBlankReferer"));
    if (!is_numeric($SquidGuardWebFollowExtensions)) {
        $SquidGuardWebFollowExtensions = 1;
    }
    if (!is_numeric($SquidGuardWebUseLocalDatabase)) {
        $SquidGuardWebUseLocalDatabase = 0;
    }
    $CATEGORY_SOURCE = $_GET["category"];
    $TARGET_GROUP_SOURCE = $_GET["targetgroup"];
    $proto = "http";
    $QUERY_STRING = $_SERVER["QUERY_STRING"];
    $HTTP_REFERER = $_SERVER["HTTP_REFERER"];
    $url = $_GET["url"];
    $URL_HOST = hostfrom_url($url);
    $HTTP_REFERER_HOST = hostfrom_url($HTTP_REFERER);
    if ($SquidGuardWebBlankReferer == 1) {
        if ($URL_HOST != $HTTP_REFERER_HOST) {
            $data = "<html><head></head><body></body></html>";
            header("Content-Length: " . strlen($data));
            header("Content-Type: text/html");
            echo $data;
            die;
        }
    }
    if (isset($_SERVER['HTTPS'])) {
        if (strtolower($_SERVER['HTTPS']) == 'on') {
            $proto = "https";
        }
    }
    while (list($num, $ligne) = each($_GET)) {
        parseTemplateLogs("GET[{$num}]=`{$ligne}`", __FUNCTION__, __FILE__, __LINE__);
    }
    $GLOBALS["JS_NO_CACHE"] = true;
    $GLOBALS["JS_HEAD_PREPREND"] = "{$proto}://{$_SERVER["SERVER_NAME"]}:{$_SERVER["SERVER_PORT"]}";
    if ($SquidGuardWebFollowExtensions == 1) {
        if (parseTemplate_extension($_GET["url"])) {
            return;
        }
    }
    if (parseTemplateForcejs($_GET["url"])) {
        parseTemplateLogs("JS detected : For {$_GET["url"]}", __FUNCTION__, __FILE__, __LINE__);
        header("content-type: application/x-javascript");
        echo "// blocked by url filtering\n";
        return true;
        return;
    }
    $defaultjs = "alert('Disabled')";
    $ADD_JS_PACK = false;
    if ($SquidGuardWebUseLocalDatabase == 1) {
        $clientaddr = base64_encode($_GET["clientaddr"]);
        $defaultjs = "s_PopUp('{$GLOBALS["JS_HEAD_PREPREND"]}/" . basename(__FILE__) . "?SquidGuardWebUseLocalDatabase=1&url=" . base64_encode("{$_GET["url"]}") . "&clientaddr={$clientaddr}',640,350)";
        $ADD_JS_PACK = true;
    }
    if ($users->CORP_LICENSE) {
        $LICENSE = 1;
        $FOOTER = null;
    }
    if (!$users->CORP_LICENSE) {
        $LICENSE = 0;
    }
    parseTemplateLogs("{$_GET["clientaddr"]}: Category=`{$CATEGORY_SOURCE}` targetgroup=`{$_GET["targetgroup"]}` LICENSE:{$LICENSE}", __FUNCTION__, __FILE__, __LINE__);
    $CATEGORY_KEY = null;
    $_GET["targetgroup"] = parseTemplate_categoryname($_GET["targetgroup"], $LICENSE);
    $_GET["clientgroup"] = parseTemplate_categoryname($_GET["clientgroup"], $LICENSE);
    $_GET["category"] = parseTemplate_categoryname($CATEGORY_SOURCE, $LICENSE);
    $CATEGORY_KEY = parseTemplate_categoryname($CATEGORY_SOURCE, $LICENSE, 1);
    if ($CATEGORY_KEY == null) {
        $CATEGORY_KEY = parseTemplate_categoryname($TARGET_GROUP_SOURCE, $LICENSE, 1);
    }
    $_CATEGORIES_K = $_GET["category"];
    $_RULE_K = $_GET["clientgroup"];
    if ($_CATEGORIES_K == null) {
        $_CATEGORIES_K = $_GET["targetgroup"];
    }
    if ($_RULE_K == null) {
        $_RULE_K = "{web_filtering}";
    }
    $REASONGIVEN = "{web_filtering} {$_CATEGORIES_K}";
    if ($_CATEGORIES_K == "restricted_time") {
        $REASONGIVEN = "{restricted_access}";
    }
    parseTemplateLogs("{$REASONGIVEN}: _CATEGORIES_K=`{$_CATEGORIES_K}` _RULE_K={$_RULE_K}` LICENSE:{$LICENSE}", __FUNCTION__, __FILE__, __LINE__);
    $IpToUid = null;
    //$IpToUid=$q->IpToUid($_GET["clientaddr"]);
    if ($IpToUid != null) {
        $IpToUid = "&nbsp;({$IpToUid})";
    }
    if ($LICENSE == 1) {
        if ($CATEGORY_KEY != null) {
            $RedirectCategory = $UfdbGuardRedirectCategories[$CATEGORY_KEY];
            if ($RedirectCategory["enable"] == 1) {
                if ($RedirectCategory["blank_page"] == 1) {
                    parseTemplateLogs("[{$CATEGORY_KEY}]: blank_page : For {$_GET["url"]}", __FUNCTION__, __FILE__, __LINE__);
                    header("HTTP/1.1 200 OK");
                    die;
                    return;
                }
                if (trim($RedirectCategory["template_data"]) != null) {
                    header('Content-Type: text/html; charset=iso-8859-1');
                    $TemplateErrorFinal = $RedirectCategory["template_data"];
                    return;
                }
            }
        }
    }
    $EnableSquidFilterWhiteListing = $sock->GET_INFO("EnableSquidFilterWhiteListing");
    if (isset($_GET["rule-id"])) {
        $ID = $_GET["rule-id"];
    }
    parseTemplateLogs("ID: {$ID}", __FUNCTION__, __FILE__, __LINE__);
    if (isset($_GET["fatalerror"])) {
        $ID = 0;
    }
    if (isset($_GET["loading-database"])) {
        $ID = 0;
    }
    if ($LICENSE == 1) {
        if (is_numeric($ID)) {
            if ($ID == 0) {
                $ligne["groupname"] = "Default";
            } else {
                $sql = "SELECT groupname FROM webfilter_rules WHERE ID={$ID}";
                $q = new mysql_squid_builder();
                $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
                $ruleName = $ligne["groupname"];
            }
        } else {
            writelogs("ID: not a numeric", __FUNCTION__, __FILE__, __LINE__);
        }
    }
    if (isset($_GET["fatalerror"])) {
        $_GET["clientaddr"] = $_SERVER["REMOTE_ADDR"];
        $_GET["clientname"] = $_SERVER["REMOTE_HOST"];
        $REASONGIVEN = "{webfiltering_issue}";
        $_CATEGORIES_K = "{system_Webfiltering_error}";
        $_RULE_K = "{service_error}";
        $_GET["url"] = $_SERVER['HTTP_REFERER'];
    }
    if (isset($_GET["loading-database"])) {
        $_GET["clientaddr"] = $_SERVER["REMOTE_ADDR"];
        $_GET["clientname"] = $_SERVER["REMOTE_HOST"];
        $REASONGIVEN = "{Webfiltering_maintenance}";
        $_CATEGORIES_K = "{please_wait_reloading_databases}";
        $_RULE_K = "{waiting_service}....";
        $_GET["url"] = $_SERVER['HTTP_REFERER'];
    }
    if (!isset($_SESSION["IPRES"][$_GET["clientaddr"]])) {
        $_SESSION["IPRES"][$_GET["clientaddr"]] = gethostbyaddr($_GET["clientaddr"]);
    }
    if (isset($_GET["source"])) {
        $_GET["clientaddr"] = $_GET["source"];
    }
    if (isset($_GET["user"])) {
        $_GET["clientname"] = $_GET["user"];
    }
    if (isset($_GET["virus"])) {
        $_GET["targetgroup"] = $_GET["virus"];
        $ruleName = null;
    }
    if ($_GET["clientuser"] != null) {
        $_GET["clientname"] = $_GET["clientuser"];
    }
    $ruleName = parseTemplate_categoryname($ruleName, $LICENSE);
    $ARRAY["URL"] = $_GET["url"];
    $ARRAY["IPADDR"] = $_GET["clientaddr"];
    $ARRAY["REASONGIVEN"] = $REASONGIVEN;
    $ARRAY["CATEGORY_KEY"] = $CATEGORY_KEY;
    $ARRAY["RULE_ID"] = $ID;
    $ARRAY["CATEGORY"] = $_CATEGORIES_K;
    $ARRAY["RULE"] = $_RULE_K;
    if ($ruleName != null) {
        $ARRAY["RULE"] = $ruleName;
    }
    $ARRAY["targetgroup"] = $_GET["targetgroup"];
    $ARRAY["IpToUid"] = $IpToUid;
    $ARRAY["clientname"] = $_GET["clientname"];
    $ARRAY["HOST"] = $_SESSION["IPRES"][$_GET["clientaddr"]];
    echo parseTemplate_build_main($ARRAY);
}