Account Data
$domainName
$today

"; echo "DiskSpace Alerts (Threshold:$mbHigh)
"; $fp=fopen($F1,"r"); while (!feof($fp)){$str .= fread ($fp, 1024);} fclose($fp); $str=str_replace("\r\n","",$str); $str=str_replace("\n","",$str); $do = preg_match_all("/(.*)<\/tr>/U", $str, $matches); if ($do == true) { $rec = array(); $emailList = array(); $output = ''; $output.= ''; $output.= ''; $output.= ''; $output.= ''; $output.= ''; while (list($keyr,$valuer) = each($matches[0])) { $rec = split("",$domain,$ip,$client,$email,$mbQuota,$mbused,$bwpercent,$package,$theme,$reseller,$warning); array_push($domainList,$client); //add to the domain name list array array_push($emailList,$email); //add to the email list array } //if not empty }; //while recs $output.="
DOMAINIPUSEREMAILQUOTA__USED__PCT_PACKAGETHEMERESELLERWARNING
",$valuer); $Accounts = array(); array_push($Accounts,$rec); $domain = trim(strip_tags($Accounts[0][1])); if ($domain!=''){ $ip= trim(strip_tags($Accounts[0][2])); $client = trim(strip_tags($Accounts[0][3])); $email = trim(strip_tags($Accounts[0][4])); $cdate = trim(strip_tags($Accounts[0][5])); $chome = trim(strip_tags($Accounts[0][6])); $quota = trim(strip_tags($Accounts[0][7])); $spaceUsed = trim(strip_tags($Accounts[0][8])); $package = trim(strip_tags($Accounts[0][9])); $theme = trim(strip_tags($Accounts[0][10])); $reseller = trim(strip_tags($Accounts[0][11])); // 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 "ALERT: $domain Actual/Allocated=$mbused/$mbQuota (".(int) $mbpercent."%) Email:$email
"; $output.=sprintf("
%s%s%s%s%05d%05d%02d%%%s%s%s%s
"; echo "
Account Listing
$output
"; echo "Total Accounts Processed: $accountTotal
Total Used Disk Space: $totalMB MB
"; } else {echo"ERROR: No data found
";} /* 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.='
'; 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
"); ?>