Пример #1
0
if ($Earliest == 0) {
    if ($View == 1) {
        Read_Day_All($FileHandle);
    } elseif ($View == 2) {
        Read_Day_Allowed($FileHandle);
    } elseif ($View == 3) {
        Read_Day_Blocked($FileHandle);
    }
    //Read Blocked only
} else {
    if ($View == 1) {
        Read_Time_All($FileHandle);
    } elseif ($View == 2) {
        Read_Time_Allowed($FileHandle);
    } elseif ($View == 3) {
        Read_Time_Blocked($FileHandle);
    }
    //Read Blocked only
}
fclose($FileHandle);
//Sort Array of Domains from log file--------------------------------
$SortedDomainList = array_count_values($DomainList);
//Take a count of number of hits
if ($SortCol == 1) {
    if ($SortDir == 0) {
        ksort($SortedDomainList);
    } else {
        krsort($SortedDomainList);
    }
} else {
    if ($SortDir == 0) {
Пример #2
0
function Load_TodayLog()
{
    //Dnsmasq log line consists of:
    //0 - Month
    //1 - Day
    //2 - Time
    //3 - dnsmasq[pid]
    //4 - Function (query, forwarded, reply, cached, config)
    //5 - Website Requested
    //6 - "is"
    //7 - IP Returned
    //The functions are replicated to reduce the number of if statements inside the loop, as this section is very CPU intensive and RPi struggles
    global $StartTime, $StartStr, $View;
    $FileHandle = fopen('/var/log/notrack.log', 'r') or die('Error unable to open /var/log/notrack.log');
    if ($StartStr == '' || $StartStr == 'today') {
        if ($View == 1) {
            Read_Day_All($FileHandle);
        } elseif ($View == 2) {
            Read_Day_Allowed($FileHandle);
        } elseif ($View == 3) {
            Read_Day_Blocked($FileHandle);
        }
        //Read Blocked only
    } else {
        if ($View == 1) {
            Read_Time_All($FileHandle);
        } elseif ($View == 2) {
            Read_Time_Allowed($FileHandle);
        } elseif ($View == 3) {
            Read_Time_Blocked($FileHandle);
        }
        //Read Blocked only
    }
    fclose($FileHandle);
    return null;
}