Report Date: $quotafile[0]
";
$quotas = array();
for ($i=3 ; $i < count($quotafile) ; $i++)
{
$thisline = $quotafile[$i];
$thisline = preg_replace("/([\s]--)/", "", $thisline);
$thisline = preg_split("/(\s)/e", $thisline, -1, PREG_SPLIT_NO_EMPTY);
$quotas[$i]['user'] = str_replace("--", "", $thisline[0]);
$quotas[$i]['mb_used'] = round (($thisline[1] / 1024), 2);
$quotas[$i]['mb_soft'] = round (($thisline[2] / 1024), 2);
$quotas[$i]['mb_hard'] = round (($thisline[3] / 1024), 2);
if ($thisline[3] != 0)
{
$quotas[$i]['mb_percent_used'] = round((($quotas[$i]['mb_used'] / $quotas[$i]['mb_hard']) * 100), 1);
}
else
{
$quotas[$i]['mb_percent_used'] = 0;
}
$quotas[$i]['file_used'] = $thisline[4];
$quotas[$i]['file_soft'] = $thisline[5];
$qoutas[$i]['file_hard'] = $thisline[6];
}
if (!$_GET['sort'])
{
$sort = 'mb_percent_used';
}
else
{
$sort = $_GET['sort'];
}
if (!$_GET['order'])
{
$order = "desc";
}
else
{
$order = $_GET['order'];
}
foreach ($quotas as $key => $row)
{
$user[$key] = $row['user'];
$mb_used[$key] = $row['mb_used'];
$mb_soft[$key] = $row['mb_soft'];
$mb_hard[$key] = $row['mb_hard'];
$mb_percent_used[$key] = $row['mb_percent_used'];
$file_used[$key] = $row['file_used'];
$file_soft[$key] = $row['file_soft'];
$file_hard[$key] = $row['file_hard'];
}
switch ($sort)
{
case "user": $sortkey =& $user; break;
case "mb_used": $sortkey =& $mb_used; break;
case "mb_soft": $sortkey =& $mb_soft; break;
case "mb_hard": $sortkey =& $mb_hard; break;
case "mb_percent_used": $sortkey =& $mb_percent_used; break;
case "file_used": $sortkey =& $file_used; break;
case "file_soft": $sortkey =& $file_used; break;
case "file_hard": $sortkey =& $file_hard; break;
}
switch ($order)
{
case "asc": $sortorder = SORT_ASC; $newsort = "desc"; break;
case "desc": $sortorder = SORT_DESC;$newsort = "asc"; break;
}
array_multisort($sortkey, $sortorder, $quotas);
echo '';
echo '';
foreach ($quotas as $quotareport)
{
if ($colour == 0) {
$colour = 1;
} else {
$colour = 0;
}
if ( $quotareport['mb_percent_used'] > $warnlimit)
{
$warn = 1;
}
else
{
$warn = 0;
}
echo '';
foreach ($quotareport as $quotaelement)
{
if ($warn)
{
echo '| ' . $quotaelement . ' | ';
}
else
{
echo '' . $quotaelement . ' | ';
}
}
echo '
';
}
echo '
';
?>