"; $unique_end = ""; $accountTotal = 0; $domainList = array(); echo "
| DOMAIN | IP | USER | QUOTA__ | USED__ | PCT_ | PACKAGE | '; $output.= 'THEME | RESELLER | WARNING | '; $output.= '",$line); while (list($key,$value) = each($rec)) { if ($value!='') { array_push($Accounts,strip_tags($value)); }; //if }; //while $accountTotal++; $domain = $Accounts[1]; $pass=1; } elseif ($pass==1) { $pass=2; } elseif ($pass==2) { $rec = split(" | ",$line);
$Accounts = array();
while (list($key,$value) = each($rec))
{
if ($value!='')
{
array_push($Accounts,strip_tags($value));
}; //if
}; //while
$ip= $Accounts[1];
$client = $Accounts[2];
$email = $Accounts[3];
$cdate = $Accounts[4];
$chome = $Accounts[5];
$quota = $Accounts[6];
$spaceUsed = $Accounts[7];
$package = $Accounts[8];
$theme = $Accounts[9];
$reseller = $Accounts[10];
// calculated variables
$firstSpace = strpos($spaceUsed," ");
($firstSpace == 0 ? $mbused = 0 : $mbused = trim(substr($spaceUsed,0,$firstSpace)));//*1024);
$firstSpace = strpos($quota," ");
($firstSpace == 0 ? $mbQuota = 0 : $mbQuota = trim(substr($quota,0,$firstSpace)));//*1024);
($mbused == 0 ? $mbpercent = 0 : $mbpercent = ($mbused/$mbQuota)*100);
($mbpercent < $mbHigh ? $warning = "OK": $warning ="ALERT");
if ($mbpercent<10){
$bwpercent='0'.(int) $mbpercent.'%';
}
else {
$bwpercent=(int) $mbpercent.'%';
}
$totalMB += $mbused;
if ($warning == "ALERT")
echo "$domain Actual/Allocated=$mbused/$mbQuota (".(int) $mbpercent."%) "; $output.=sprintf(" |
| %s | %s | %s | %s | %05d | %05d | %02d%% | %s | %s | %s | %s |
| Domain___________________ | '; $output.= 'Actual BW | Quota BW | '; $output.= 'PCT% | WARNING | '; $output.= '",$line);
$loc = strpos($rec[0],'value="');
$endloc = strpos($rec[0],'"',$loc+7);
$bwlimit = substr($rec[0],$loc+7,$endloc-$loc-7);
$bwpct = 0;
if ($bwlimit>0 and $bwactual>0)
{
$bwpct = ($bwactual*100)/$bwlimit;
}
($bwpct < $bwHigh ? $warning = "OK": $warning ="ALERT");
if ((int) $bwpct<10){
$bwpercent='0'.(int) $bwpct.'%';
}
else {
$bwpercent=(int) $bwpct.'%';
}
if ($warning=="ALERT")
echo ("$domain Bandwidth ALERT $bwactual/$bwlimit (".(int) $bwpct."%) email:$emailList[$i] "); $output.=sprintf(" | %05d | %02d%% | %s | ",$bwlimit,$bwpercent,$warning); $totalBW+=$bwactual; $bwCount++; } elseif ((strpos($line,'meg'))) { $rec = split("",$line); $tempit = strip_tags($rec[0]); $loc = strpos($tempit,' meg'); $bwactual = trim(substr($tempit,1,$loc-1)); $output.=sprintf(" |
| %s | %05d | ",$domain,$bwactual); } elseif ((strpos($line,'name="user"'))) { $rec = split("",$line); $tempit = strip_tags($rec[0]); $loc = strpos($tempit," [$domainlist[$i]"); $domain = ltrim(substr($tempit,1,$loc-1)); } } } } $output.=' |