"; $unique_end = ""; $accountTotal = 0; $domainList = array(); echo "

Account Data
$domainName
$today


"; echo "DiskSpace Alerts (Threshold:$mbHigh)
"; $data=@file($F1); /* process the html page */ if ( is_array($data) ) { $Accounts = array(); //init the storage array $accountsIndex = 0; //init account counter $totalMB = 0; $emailList = array(); //init the email array $output = ''; $output.= ''; $output.= ''; $output.= ''; $output.= ''; $output.= ''; foreach ( $data as $line ) { $howmany = strpos($line,$unique_start); if ($howmany===0) { $rec = array(); $Accounts = array(); $rec = split("",$domain,$ip,$client,$email,$mbQuota,$mbused,$bwpercent,$package,$theme,$reseller,$warning); array_push($domainList,$client); array_push($emailList,$email); //add to the email list array $pass=0; } //if } //for $output.="
DOMAINIPUSEREMAILQUOTA__USED__PCT_PACKAGETHEMERESELLERWARNING
",$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
"; } else { echo("OOPS! No array was detected.
"); } echo "
Account Listing
$output
"; echo "Total Accounts Processed: $accountTotal
Total Used Disk Space: $totalMB MB
"; /* get domain bw */ echo "Bandwidth Alerts (Threshold:$bwHigh)
"; $accountNumber=count($domainList); // count the number of rows $output = ''; $bwCount = 0; $totalBW = 0; $output = ''; $output.= ''; $output.= ''; $output.= ''; $output.= ''; $output.= ''; for ($i=0; $i<$accountNumber; $i++) { $F6 = $Fx."scripts2/limitbw?domain=$domainList[$i]&user=$domainList[$i]&submit-domain=Limit"; $data=@file($F6); if ( is_array($data) ) { foreach ( $data as $line ) { if ((strpos($line,'"bwlimit')) and (strpos($line,'meg'))) { $rec = split("",$bwlimit,$bwpercent,$warning); $totalBW+=$bwactual; $bwCount++; } elseif ((strpos($line,'meg'))) { $rec = split("",$domain,$bwactual); } elseif ((strpos($line,'name="user"'))) { $rec = split("
Domain___________________Actual BWQuota BWPCT%WARNING
",$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
",$line); $tempit = strip_tags($rec[0]); $loc = strpos($tempit,' meg'); $bwactual = trim(substr($tempit,1,$loc-1)); $output.=sprintf("
%s%05d",$line); $tempit = strip_tags($rec[0]); $loc = strpos($tempit," [$domainlist[$i]"); $domain = ltrim(substr($tempit,1,$loc-1)); } } } } $output.='
'; $fp=fopen("temp.txt","w"); @fwrite($fp,$output); @fclose($fp); echo "
Bandwidth Data
$output
"; echo ("Completed Bandwidth Processing
"); echo "Total bandwidths: $bwCount [$totalBW MB]
"; echo ("
Version $myVersion Original code by DOMAJ http://www.domaj.com tony@domaj.com
"); ?>