WLOG("{$DCOUNT}] LOOP::URL `{$url}` is null [" . __LINE__ . "]");
        }
        continue;
    }
    $DCOUNT++;
    if (!$GLOBALS["XVFERTSZ"]) {
        $error = urlencode("License Error, please remove Artica categories objects in ACL");
        WLOG("LOOP():: License Error ! [" . __LINE__ . "]");
        fwrite(STDOUT, "BH message={$error}\n");
        continue;
    }
    try {
        if ($GLOBALS["DEBUG"]) {
            WLOG("LOOP Send ->`{$url}`");
        }
        $categories_match = categories_match($GLOBALS["CATZ-EXTRN"], $url);
    } catch (Exception $e) {
        $error = $e->getMessage();
        WLOG("{$DCOUNT}] LOOP::FATAL ERROR {$error}");
        $result = false;
    }
    if ($categories_match != null) {
        fwrite(STDOUT, "OK message={$categories_match}\n");
        continue;
    }
    fwrite(STDOUT, "ERR\n");
    continue;
}
WLOG("Stopping PID:{$GLOBALS["MYPID"]} After {$DCOUNT} event(s) SAVED {$GLOBALS["DATABASE_ITEMS"]} items in database");
function WLOG($text = null)
{
     if ($ChartID > 0) {
         $error = base64_encode(serialize(array("ChartID" => $ChartID, "LOGIN" => $array["LOGIN"], "IPADDR" => $array["IPADDR"], "MAC" => $array["MAC"])));
         fwrite(STDOUT, "ERR message={$error}\n");
         continue;
     }
     fwrite(STDOUT, "OK\n");
     continue;
 }
 if ($GLOBALS["CATZ-EXTRN"] > 0) {
     if (!$GLOBALS["XVFERTSZ"]) {
         $error = urlencode("License Error, please remove Artica categories objects in ACL");
         WLOG("LOOP():: License Error ! [" . __LINE__ . "]");
         fwrite(STDOUT, "BH message={$error}\n");
         continue;
     }
     $categories_match = categories_match($GLOBALS["CATZ-EXTRN"], $array["RHOST"]);
     if ($categories_match != null) {
         fwrite(STDOUT, "OK message={$categories_match}\n");
         continue;
     }
     fwrite(STDOUT, "ERR\n");
     continue;
 }
 if (isset($array["LOGIN"])) {
     if ($GLOBALS["DEBUG_LEVEL"] > 3) {
         WLOG("LOOP()::{$GLOBALS["RULE_ID"]} ->{$array["LOGIN"]} type 2");
     }
     $ID = CheckPattern($array["LOGIN"], $GLOBALS["RULE_ID"], 2);
 }
 if ($ID == 0) {
     if (isset($array["HOST"])) {
    if ($GLOBALS["DEBUG"]) {
        WLOG("{$GLOBALS["DOMAIN"]}: LOOP channel={$prefix_channel} [{$Buffer}] ->`{$url}` -> {$groupid}");
    }
    $DCOUNT++;
    if (!$GLOBALS["XVFERTSZ"]) {
        $error = urlencode("License Error, please remove Artica categories objects in ACL");
        WLOG("{$GLOBALS["DOMAIN"]}: LOOP():: License Error ! [" . __LINE__ . "]");
        categories_logs("{$groupid};ERROR;License error");
        fwrite(STDOUT, "{$prefix_channel}BH message={$error}\n");
        continue;
    }
    try {
        if ($GLOBALS["DEBUG"]) {
            WLOG("{$GLOBALS["DOMAIN"]}:LOOP Send ->`{$url}`");
        }
        $RESULT = categories_match($groupid, $url, $MD5KEY);
    } catch (Exception $e) {
        $error = $e->getMessage();
        WLOG("{$GLOBALS["DOMAIN"]}: {$DCOUNT}] LOOP::FATAL ERROR {$error}");
        $result = false;
    }
    if ($RESULT) {
        fwrite(STDOUT, "{$prefix_channel}OK message={$TAG}\n");
        continue;
    }
    fwrite(STDOUT, "{$prefix_channel}ERR\n");
    continue;
}
WLOG("Stopping PID:{$GLOBALS["MYPID"]} After {$DCOUNT} event(s) SAVED {$GLOBALS["DATABASE_ITEMS"]} items in database");
function WLOG($text = null)
{