function search()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql_squid_builder();
    $t = $_GET["t"];
    $total = 0;
    if ($q->COUNT_ROWS("dashboard_user_day", "artica_backup") == 0) {
        json_error_show("no data [" . __LINE__ . "]", 0);
    }
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    $table = "(SELECT SUM(RQS) as RQS, SUM(SIZE) as SIZE,USER FROM dashboard_user_day GROUP BY USER ) as t";
    $searchstring = string_to_flexquery();
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if (!is_numeric($rp)) {
        $rp = 100;
    }
    $pageStart = ($page - 1) * $rp;
    if ($pageStart < 0) {
        $pageStart = 0;
    }
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT *  FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql}";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql, "artica_events");
    $total = mysql_num_rows($results);
    if (!$q->ok) {
        json_error_show($q->mysql_error . "<br>{$sql}", 0);
    }
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    $CurrentPage = CurrentPageName();
    if (mysql_num_rows($results) == 0) {
        json_error_show("no data");
    }
    $searchstring = string_to_flexquery();
    $results = $q->QUERY_SQL($sql, 'artica_backup');
    if (!$q->ok) {
        json_error_show($q->mysql_error . "<br>{$sql}");
    }
    $q1 = new mysql();
    $t = time();
    $fontsize = 22;
    $span = "<span style='font-size:{$fontsize}px'>";
    $IPTCP = new IP();
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $zmd5 = $ligne["zmd5"];
        $member_value = trim($ligne["USER"]);
        $hits = FormatNumber($ligne["RQS"]);
        $size = FormatBytes($ligne["SIZE"] / 1024);
        $ahref = null;
        $member_assoc = null;
        $graph = imgtootltip("graph2-48.png", "{statistics}", "Loadjs('{$MyPage}?graph-js=yes&uid=" . urlencode($member_value) . "')");
        $graph2 = imgtootltip("graphs-48.png", "{statistics}", "Loadjs('{$MyPage}?graph2-js=yes&uid=" . urlencode($member_value) . "')");
        if ($IPTCP->IsvalidMAC($member_value)) {
            $mac_encoded = urlencode($member_value);
            $uid = $q->MacToUid($member_value);
            if ($uid != null) {
                $member_assoc = "&nbsp; ({$uid})";
            }
            $ahref = "<a href=\"javascript:blur();\"\n\t\t\t\t\tOnClick=\"javascript:Loadjs('squid.nodes.php?node-infos-js=yes&MAC={$mac_encoded}');\"\n\t\t\t\t\tstyle='font-size:{$fontsize};text-decoration:underline'>";
        }
        $data['rows'][] = array('id' => $member_value, 'cell' => array("{$span}{$ahref}{$member_value}</a>{$member_assoc}</span>", "{$span}{$hits}</a></span>", "{$span}{$size}</a></span>", "<center>{$graph}</center>", "<center>{$graph2}</center>"));
    }
    echo json_encode($data);
}
Ejemplo n.º 2
0
function VOLUME_LOG_HOURLY_SCAN($workfile)
{
    $unix = new unix();
    $LastScannLine = 0;
    if (is_file("{$workfile}.last")) {
        $LastScannLine = intval(@file_get_contents("{$workfile}.last"));
    }
    $handle = @fopen($workfile, "r");
    if (!$handle) {
        events("Fopen failed on {$workfile}");
        return false;
    }
    if ($LastScannLine > 0) {
        fseek($handle, $LastScannLine, SEEK_SET);
    }
    $handle = @fopen($workfile, "r");
    if (!$handle) {
        events("Fopen failed on {$workfile}");
        return false;
    }
    if ($LastScannLine > 0) {
        fseek($handle, $LastScannLine, SEEK_SET);
    }
    $MEM = array();
    $proxyname = $unix->hostname_g();
    $catz = new mysql_catz();
    $q = new mysql_squid_builder();
    while (!feof($handle)) {
        $buffer = trim(fgets($handle));
        if ($buffer == null) {
            continue;
        }
        $ARRAY = explode(":::", $buffer);
        $TIME = $ARRAY[0];
        $USERID = $ARRAY[1];
        $MAC = $ARRAY[3];
        if ($USERID == null) {
            $USERID = $q->MacToUid($MAC);
        }
        $IPADDR = $ARRAY[2];
        if ($IPADDR == "127.0.0.1") {
            continue;
        }
        $CONTENT_TYPE = $ARRAY[4];
        $FAMILYSITE = $ARRAY[5];
        $HITS = $ARRAY[6];
        $SIZE = $ARRAY[7];
        $HOURTIME = date("Y-m-d H:00:00", $TIME);
        $KEYMD5 = md5("{$HOURTIME}{$USERID}{$IPADDR}{$MAC}{$FAMILYSITE}{$CONTENT_TYPE}");
        if (!isset($MEM[$KEYMD5])) {
            if ($GLOBALS["VERBOSE"]) {
                echo "{$KEYMD5}] VOLUME_LOG_HOURLY_SCAN: {$HOURTIME} {$USERID}/{$IPADDR}/{$MAC} {$FAMILYSITE} {$CONTENT_TYPE} {$HITS}/{$SIZE}\n";
            }
            $MEM[$KEYMD5]["TIME"] = QueryToUTC(strtotime($HOURTIME), true);
            $MEM[$KEYMD5]["USERID"] = $USERID;
            $MEM[$KEYMD5]["IPADDR"] = $IPADDR;
            $MEM[$KEYMD5]["MAC"] = $MAC;
            $MEM[$KEYMD5]["FAMILYSITE"] = $FAMILYSITE;
            $MEM[$KEYMD5]["CATEGORY"] = $catz->GET_CATEGORIES($FAMILYSITE);
            $MEM[$KEYMD5]["CONTENT_TYPE"] = $CONTENT_TYPE;
            $MEM[$KEYMD5]["SIZE"] = $SIZE;
            $MEM[$KEYMD5]["ZDATE"] = strtotime($HOURTIME);
            $MEM[$KEYMD5]["PROXYNAME"] = $proxyname;
            $MEM[$KEYMD5]["RQS"] = $HITS;
        } else {
            $MEM[$KEYMD5]["RQS"] = $MEM[$KEYMD5]["RQS"] + $HITS;
            $MEM[$KEYMD5]["SIZE"] = $MEM[$KEYMD5]["SIZE"] + $SIZE;
            if ($GLOBALS["VERBOSE"]) {
                echo "{$KEYMD5}] VOLUME_LOG_HOURLY_SCAN: {$HOURTIME} {$USERID}/{$IPADDR}/{$MAC} {$FAMILYSITE} {$CONTENT_TYPE} {$MEM[$KEYMD5]["RQS"]}/{$MEM[$KEYMD5]["SIZE"]}\n";
            }
        }
        if (count($MEM) > 5000) {
            VOLUME_LOG_HOURLY_DUMP($MEM);
            VOLUME_LOG_HOURLY_MYSQL_DUMP($MEM);
            $MEM = array();
        }
    }
    VOLUME_LOG_HOURLY_MYSQL_DUMP($MEM);
    VOLUME_LOG_HOURLY_DUMP($MEM);
    @unlink($workfile);
}
function _access_dbmonth($sourcetable, $monthtable)
{
    $berekley = new parse_berekley_dbs();
    $q = new mysql_squid_builder();
    $sql = $berekley->ACCESS_PARSE_TABLE_STRING($monthtable);
    if (!$q->QUERY_SQL($sql)) {
        if ($GLOBALS["VERBOSE"]) {
            echo "{$monthtable} {$q->mysql_error}\n";
        }
        return;
    }
    $results = $q->QUERY_SQL("SELECT zDate,familysite,category,hour,uid,ipaddr,MAC,SUM(hits) as hits, SUM(size) as size\n\tFROM {$sourcetable} GROUP BY zDate,familysite,category,hour,uid,ipaddr,MAC");
    $f = array();
    if (!$q->ok) {
        return false;
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $md5 = md5(serialize($ligne));
        $familysite = mysql_escape_string2($ligne["familysite"]);
        $uid = trim($ligne["uid"]);
        $MAC = $ligne["MAC"];
        $ipaddr = $ligne["ipaddr"];
        if ($uid == null) {
            $uid = $q->MacToUid($MAC);
        }
        if ($uid == null) {
            $uid = $q->IpToUid($ipaddr);
        }
        $uid = mysql_escape_string2($ligne["uid"]);
        $category = mysql_escape_string2($ligne["category"]);
        $zDate = $ligne["zDate"];
        $MAC = $ligne["MAC"];
        $hour = $ligne["hour"];
        $size = $ligne["size"];
        $hits = $ligne["hits"];
        $f[] = "('{$md5}','{$zDate}','{$hour}','{$familysite}','{$category}','{$uid}','{$MAC}','{$ipaddr}','{$hits}','{$size}')";
    }
    if (count($f) > 0) {
        $q->QUERY_SQL("INSERT IGNORE INTO `{$monthtable}` \n\t\t(`zmd5`,`zDate`,`hour`,`familysite`,`category`,`uid`,`MAC`,`ipaddr`,`hits`,`size`) VALUES\n\t\t" . @implode(",", $f));
        if (!$q->ok) {
            return false;
        }
    }
    return true;
}
Ejemplo n.º 4
0
function search()
{
    $base = "/home/squid/rttsize";
    $YEAR = date("Y");
    $MONTH = date("m");
    $DAY = date("d");
    $HOUR = date("H");
    $WEEK = date("W");
    if (!isset($_GET["SUBDIR"])) {
        $_GET["SUBDIR"] = "UID";
    }
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    $TIMES_SLOT["hour"] = "/home/squid/rttsize/{$YEAR}/{$MONTH}/{$WEEK}/{$DAY}/{$HOUR}/{$_GET["SUBDIR"]}";
    $TIMES_SLOT["day"] = "/home/squid/rttsize/{$YEAR}/{$MONTH}/{$WEEK}/{$DAY}/{$_GET["SUBDIR"]}";
    $TIMES_SLOT["week"] = "/home/squid/rttsize/{$YEAR}/{$MONTH}/{$WEEK}/{$_GET["SUBDIR"]}";
    $TIMES_SLOT["month"] = "/home/squid/rttsize/{$YEAR}/{$MONTH}/{$_GET["SUBDIR"]}";
    $baseWeek = "/home/squid/rttsize/{$YEAR}/{$MONTH}/{$WEEK}/{$_GET["SUBDIR"]}";
    $baseMonth = "/home/squid/rttsize/{$YEAR}/{$MONTH}/{$_GET["SUBDIR"]}";
    $directory_path = $TIMES_SLOT[$_GET["timeslot"]];
    if (!is_dir($directory_path)) {
        json_error_show("{$directory_path} no such dir");
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "{$directory_path}\n";
    }
    $directory = opendir($directory_path);
    $DATAS = array();
    while ($file = readdir($directory)) {
        if ($file == ".") {
            continue;
        }
        if ($file == "..") {
            continue;
        }
        $dirpath = "{$directory_path}/{$file}";
        if ($GLOBALS["VERBOSE"]) {
            echo "{$dirpath}\n";
        }
        if ($_GET["SUBDIR"] == "WEBS") {
            $TOT = intval(@file_get_contents("{$dirpath}"));
            if ($TOT == 0) {
                continue;
            }
            $DATAS[] = "('{$file}','{$TOT}')";
            continue;
        }
        if ($_GET["SUBDIR"] == "CATS") {
            $TOT = intval(@file_get_contents("{$dirpath}"));
            if ($TOT == 0) {
                continue;
            }
            $DATAS[] = "('{$file}','{$TOT}')";
            continue;
        }
        if (!is_dir($dirpath)) {
            if ($GLOBALS["VERBOSE"]) {
                echo "{$dirpath} not a dir\n";
            }
            continue;
        }
        if ($GLOBALS["VERBOSE"]) {
            if (!is_file("{$dirpath}/TOT")) {
                echo "{$dirpath}/TOT not a file\n";
            }
        }
        $TOT = intval(@file_get_contents("{$dirpath}/TOT"));
        if ($TOT == 0) {
            continue;
        }
        $DATAS[] = "('{$file}','{$TOT}')";
    }
    closedir($directory);
    if (count($DATAS) == 0) {
        json_error_show("no data");
    }
    $q = new mysql_squid_builder();
    if (!$q->TABLE_EXISTS("TMP_RTTSIZE")) {
        $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `TMP_RTTSIZE` (\n\t\t\t  `SIZE` BIGINT UNSIGNED NOT NULL,\n\t\t\t  `pattern`  varchar(128) NOT NULL PRIMARY KEY,\n\t\t\t   KEY `SIZE` (`SIZE`)\n\t\t\t ) ENGINE=MYISAM;");
        if (!$q->ok) {
            json_error_show("CREATE TABLE:{$q->mysql_error}");
        }
    }
    $q->QUERY_SQL("TRUNCATE TABLE TMP_RTTSIZE");
    $sql = "INSERT IGNORE INTO TMP_RTTSIZE (pattern,SIZE) VALUES " . @implode(",", $DATAS);
    $q->QUERY_SQL($sql);
    if (!$q->ok) {
        json_error_show("INSERT: {$q->mysql_error}<br>{$sql}");
    }
    $table = "TMP_RTTSIZE";
    $searchstring = string_to_flexquery();
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if (!is_numeric($rp)) {
        $rp = 100;
    }
    $page = 1;
    $data['page'] = $page;
    $pageStart = ($page - 1) * $rp;
    if ($pageStart < 0) {
        $pageStart = 0;
    }
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    if ($searchstring == null) {
        $data['total'] = $q->COUNT_ROWS("FULL_USERS_DAY");
    } else {
        $sql = "SELECT COUNT(*) as tcount FROM FULL_USERS_DAY WHERE 1 {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        $data['total'] = $ligne["tcount"];
    }
    $data['rows'] = array();
    $CurrentPage = CurrentPageName();
    $sql = "SELECT *  FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql}";
    $results = $q->QUERY_SQL($sql, 'artica_backup');
    if (mysql_num_rows($results) == 0) {
        json_error_show("no data");
    }
    if (!$q->ok) {
        json_error_show($q->mysql_error . "<br>{$sql}");
    }
    $q1 = new mysql();
    $t = time();
    $fontsize = 22;
    $span = "<span style='font-size:{$fontsize}px'>";
    $IPTCP = new IP();
    $c = 0;
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $zmd5 = $ligne["zmd5"];
        $member_value = trim($ligne["pattern"]);
        $size = FormatBytes($ligne["SIZE"] / 1024);
        $ahref = null;
        $member_assoc = null;
        if ($IPTCP->IsvalidMAC($member_value)) {
            $mac_encoded = urlencode($member_value);
            $uid = $q->MacToUid($member_value);
            if ($uid != null) {
                $member_assoc = "&nbsp; ({$uid})";
            }
            $ahref = "<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:Loadjs('squid.nodes.php?node-infos-js=yes&MAC={$mac_encoded}');\"\n\t\t\tstyle='font-size:{$fontsize};text-decoration:underline'>";
        }
        $c++;
        $data['rows'][] = array('id' => $member_value, 'cell' => array("{$span}{$ahref}{$member_value}</a>{$member_assoc}</span>", "{$span}{$size}</a></span>"));
    }
    $data['total'] = $c;
    echo json_encode($data);
}
function search()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql_squid_builder();
    $t = $_GET["t"];
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `FULL_USERS_DAY` (\n\t\t\t`user` varchar(128) NOT NULL,\n\t\t\t`hits` BIGINT UNSIGNED NOT NULL,\n\t\t\t`size` BIGINT UNSIGNED NOT NULL,\n\t\t\tPRIMARY KEY `user` (`user`),\n\t\t\tKEY `hits` (`hits`),\n\t\t\tKEY `size` (`size`)\n\t) ENGINE=MYISAM;");
    $data = array();
    if ($q->COUNT_ROWS("FULL_USERS_DAY", "artica_backup") == 0) {
        json_error_show("no data [" . __LINE__ . "]", 0);
    }
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    $table = "FULL_USERS_DAY";
    $searchstring = string_to_flexquery();
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if (!is_numeric($rp)) {
        $rp = 100;
    }
    $data['page'] = $page;
    $pageStart = ($page - 1) * $rp;
    if ($pageStart < 0) {
        $pageStart = 0;
    }
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    if ($searchstring == null) {
        $data['total'] = $q->COUNT_ROWS("FULL_USERS_DAY");
    } else {
        $sql = "SELECT COUNT(*) as tcount FROM FULL_USERS_DAY WHERE 1 {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        $data['total'] = $ligne["tcount"];
    }
    $data['rows'] = array();
    $CurrentPage = CurrentPageName();
    $sql = "SELECT *  FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql}";
    $results = $q->QUERY_SQL($sql, 'artica_backup');
    if (mysql_num_rows($results) == 0) {
        json_error_show("no data");
    }
    if (!$q->ok) {
        json_error_show($q->mysql_error . "<br>{$sql}");
    }
    $q1 = new mysql();
    $t = time();
    $fontsize = 22;
    $span = "<span style='font-size:{$fontsize}px'>";
    $IPTCP = new IP();
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $zmd5 = $ligne["zmd5"];
        $member_value = trim($ligne["user"]);
        $hits = FormatNumber($ligne["hits"]);
        $size = FormatBytes($ligne["size"] / 1024);
        $ahref = null;
        $member_assoc = null;
        $graph = imgtootltip("graph2-48.png", "{statistics}", "Loadjs('{$MyPage}?graph-js=yes&uid=" . urlencode($member_value) . "')");
        $graph2 = imgtootltip("graphs-48.png", "{statistics}", "Loadjs('{$MyPage}?graph2-js=yes&uid=" . urlencode($member_value) . "')");
        if ($IPTCP->IsvalidMAC($member_value)) {
            $mac_encoded = urlencode($member_value);
            $uid = $q->MacToUid($member_value);
            if ($uid != null) {
                $member_assoc = "&nbsp; ({$uid})";
            }
            $ahref = "<a href=\"javascript:blur();\"\n\t\t\t\t\tOnClick=\"javascript:Loadjs('squid.nodes.php?node-infos-js=yes&MAC={$mac_encoded}');\"\n\t\t\t\t\tstyle='font-size:{$fontsize};text-decoration:underline'>";
        }
        $data['rows'][] = array('id' => $member_value, 'cell' => array("{$span}{$ahref}{$member_value}</a>{$member_assoc}</span>", "{$span}{$hits}</a></span>", "{$span}{$size}</a></span>", "<center>{$graph}</center>", "<center>{$graph2}</center>"));
    }
    echo json_encode($data);
}
function xqueries()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $influx = new influx();
    $sql = "SELECT MAX(ZDATE) AS MAX FROM access_log";
    $main = $influx->QUERY_SQL($sql);
    $MAX = $main[0]->MAX;
    $LastEntry = $tpl->time_to_date($MAX, true);
    if ($GLOBALS["VERBOSE"]) {
        echo "<p style='color:blue'>{$MAX} -> {$LastEntry}</p>";
    }
    $from_gmt = $tpl->time_to_date($MAX - 300, true);
    $from = QueryToUTC($MAX - 300);
    $fromTime = date("Y-m-d H:i:s", $from);
    $ToTime = date("Y-m-d H:i:s", QueryToUTC($MAX));
    $sql = "SELECT * from access_log WHERE time > '{$fromTime}' AND time < '{$ToTime}'";
    //echo "<hr>$sql</HR>";
    $main = null;
    $influx2 = new influx();
    $QUERY2 = $influx2->QUERY_SQL($sql);
    $color = null;
    $ipClass = new IP();
    $q = new mysql_squid_builder();
    $c = 0;
    $D = 0;
    foreach ($QUERY2 as $row) {
        $USER = trim($row->USERID);
        $IPADDR = trim($row->IPADDR);
        $MAC = trim($row->MAC);
        if ($row->SIZE == 0) {
            continue;
        }
        if (is_numeric($USER)) {
            continue;
        }
        $RQS = $row->RQS;
        $time = InfluxToTime($row->time);
        $DATEKEY = date("H:00", $time);
        $KEYMD5 = md5("{$USER}{$IPADDR}{$MAC}");
        $c = $c + $RQS;
        $D = $D + $row->SIZE;
        if (!isset($MAIN[$DATEKEY][$KEYMD5])) {
            $MAIN[$DATEKEY][$KEYMD5]["USER"] = $USER;
            $MAIN[$DATEKEY][$KEYMD5]["IPADDR"] = $IPADDR;
            $MAIN[$DATEKEY][$KEYMD5]["MAC"] = $MAC;
            $MAIN[$DATEKEY][$KEYMD5]["SIZE"] = $row->SIZE;
            $MAIN[$DATEKEY][$KEYMD5]["RQS"] = $RQS;
        } else {
            $MAIN[$DATEKEY][$KEYMD5]["SIZE"] = $MAIN[$DATEKEY][$KEYMD5]["SIZE"] + $row->SIZE;
            $MAIN[$DATEKEY][$KEYMD5]["RQS"] = $MAIN[$DATEKEY][$KEYMD5]["RQS"] + $RQS;
        }
    }
    $D = FormatBytes($D / 1024);
    $requests = $tpl->javascript_parse_text("{requests}");
    $last_entry_on = $tpl->javascript_parse_text("{last_entry_on}");
    $since = $tpl->_ENGINE_parse_body("{since}");
    $html[] = "\n\t\n\t<div style='width:98%' class=form>\n\t<div style='margin-top:5px;font-size:16px;text-align:right;margin-bottom:15px;font-weight:bold'>\n\t\t{$since} 5mn ({$c} {$requests} / {$D}) UTC:" . $tpl->time_to_date($from, true) . " - GMT {$from_gmt} / {$last_entry_on}: {$LastEntry}</div>";
    $html[] = "\n\t\t\n\t<table style='width:100%'>";
    $html[] = $tpl->_ENGINE_parse_body("<tr>\n\t\t\t<th style='font-size:18px'>{time}</th>\n\t\t\t<th style='font-size:18px'>{MAC}</th>\n\t\t\t<th style='font-size:18px'>{ipaddr}</th>\n\t\t\t<th style='font-size:18px'>{uid}</th>\n\t\t\t<th style='font-size:18px'>{requests}</th>\n\t\t\t<th style='font-size:18px'>{size}</th>\n\t\t\t</tr>\n\t\t\t");
    while (list($time, $SUBARRAY) = each($MAIN)) {
        while (list($KEYMD5, $BIGARRAY) = each($SUBARRAY)) {
            if ($color == null) {
                $color = "#F2F0F1";
            } else {
                $color = null;
            }
            $MAC = $BIGARRAY["MAC"];
            $RQS = $BIGARRAY["RQS"];
            $SIZE = $BIGARRAY["SIZE"];
            $USER = $BIGARRAY["USER"];
            $IPADDR = $BIGARRAY["IPADDR"];
            $MAC_link = null;
            if ($SIZE > 1024) {
                $size = FormatBytes($SIZE / 1024);
            } else {
                $size = "{$SIZE}Bytes";
            }
            $RQS = FormatNumber($RQS);
            if ($ipClass->IsvalidMAC($MAC)) {
                $MAC_link = "<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:Loadjs('squid.nodes.php?node-infos-js=yes&MAC=" . urlencode($MAC) . "');\"\n\t\t\tstyle='font-size:16px;text-decoration:underline;font-weight:bold'>\t\t\n\t\t\t";
                if (trim($USER) == null) {
                    $USER = $q->MacToUid($MAC);
                }
            }
            $html[] = "<tr style='background-color:{$color}'>";
            $html[] = "<td style='font-size:16px;width:50px;padding:10px;font-weight:bold'>{$time}</td>";
            $html[] = "<td style='font-size:16px;width:50px;padding:10px;font-weight:bold'>{$MAC_link}{$MAC}</a></td>";
            $html[] = "<td style='font-size:16px;width:50px;padding:10px;font-weight:bold'>{$IPADDR}</td>";
            $html[] = "<td style='font-size:16px;width:50px;padding:10px;font-weight:bold'>{$USER}</td>";
            $html[] = "<td style='font-size:16px;width:50px;text-align:right;padding:10px' nowrap>{$RQS}</td>";
            $html[] = "<td style='font-size:16px;width:50px;text-align:right;padding:10px' nowrap>{$size}</td>";
            $html[] = "</tr>";
        }
    }
    $html[] = "</table>";
    $html[] = "</div>";
    $html[] = "\n\t<script>\n\t\tfunction FollowerRefresh(){\n\t\t\tif(!document.getElementById('ZRTRQUESTS_COMPTER')){ return;}\n\t\t\tvar compter=parseInt(document.getElementById('ZRTRQUESTS_COMPTER').value);\n\t\t\tif(compter<10){\n\t\t\t\tcompter=compter+1;\n\t\t\t\tdocument.getElementById('ZRTRQUESTS_COMPTER').value=compter;\n\t\t\t\tsetTimeout(\"FollowerRefresh()\",1000);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tdocument.getElementById('ZRTRQUESTS_COMPTER').value=0;\n\t\t\tif(!document.getElementById('proxy-follower-table')){ return;}\n\t\t\tLoadAjaxSilent('proxy-follower-table','{$page}?follow=yes&t={$_GET["t"]}');\n\t\t}\n\t\t\t\n\t\t\t\n\tsetTimeout(\"FollowerRefresh()\",1000);\n\t</script>";
    echo @implode("\n", $html);
}