/**
 * handleBadUsers()
 *
 */
function handleBadUsers($dbSocket)
{
    global $configValues;
    // get all online users
    $sql = " SELECT " . " RadAcctId, AcctSessionId, UserName, NASIPAddress, NASPortId, AcctStartTime, AcctSessionTime, AcctInputOctets, AcctOutputOctets, " . " CalledStationId, CallingStationId, FramedIPAddress " . " FROM " . $configValues['CONFIG_DB_TBL_RADACCT'] . " WHERE " . " (AcctStopTime = '0000-00-00 00:00:00' OR AcctStopTime IS NULL) ";
    $res = $dbSocket->query($sql);
    $users = array();
    while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
        $download = (double) $row['AcctOutputOctets'];
        $upload = (double) $row['AcctInputOctets'];
        $traffic = (double) $download + $upload;
        $message = getHTMLMessage($row);
        if ($traffic >= $configValues['SOFTLIMIT']) {
            $subject = "daloRADIUS Traffic Notification: Soft Limit";
            sendEmailNotification($subject, $message);
        } else {
            if ($traffic >= $configValues['HARDLIMIT']) {
                $subject = "daloRADIUS Traffic Notification: Hard Limit";
                sendEmailNotification($subject, $message);
            } else {
                continue;
            }
        }
    }
}
Exemplo n.º 2
0
function getHardDelayNodes($dbSocket)
{
    global $configValues;
    $sql = "SELECT " . "mac,  memfree,  cpu,  wan_ip,  wan_gateway,  lan_mac,  firmware,  firmware_revision " . " FROM " . $configValues['CONFIG_DB_TBL_DALONODE'] . " WHERE ( UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(time) ) > " . $configValues['HARD_DELAY_SEC'];
    $res = $dbSocket->query($sql);
    $nodes = array();
    while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
        $message = getHTMLMessage($row);
        $subject = "daloRADIUS Node Monitor: Offline Node";
        sendEmailNotification($subject, $message);
    }
}