','',''); mysql_select_db('postfixpolicyd'); // Apply changes to DB, if any if($_POST) { foreach($_POST as $key => $value) { // Monkeypatching... $key = str_replace('_', '.', $key); if(is_numeric($value)) { mysql_query("DELETE FROM throttle WHERE _from = '".$key."'"); mysql_query("INSERT INTO throttle VALUES('".$key."',$value,1,UNIX_TIMESTAMP(),0,2000000000,86400,102400000,0,$value,1,0,0,0,0,0,0)"); mysql_query("FLUSH TABLES"); echo "

Quota from user '$key' changed to $value.

"; } else echo "

PLease, insert a number.

"; } } // Order by (default: count) $orderby = 'ORDER BY _count_cur DESC'; $top10_str = 'top 10'; $all_str = 'all'; $countcurr_str = 'Count curr.'; $quotacurr_str = 'Quota curr.'; if($_GET) { if($_GET['list'] != 'all') { $top10_str = 'top 10'; if($_GET['ord'] == 'count') { $orderby = 'ORDER BY _count_cur DESC LIMIT 10'; $countcurr_str = 'Count curr.'; $quotacurr_str = 'Quota curr.'; $all_str = 'all'; } else { $orderby = 'ORDER BY _quota_cur DESC LIMIT 10'; $countcurr_str = 'Count curr.'; $quotacurr_str = 'Quota curr.'; $all_str = 'all'; } } else { $orderby = $orderby; $all_str = 'all'; if($_GET['ord'] == 'count') { $orderby = 'ORDER BY _count_cur DESC'; $countcurr_str = 'Count curr.'; $quotacurr_str = 'Quota curr.'; $top10_str = 'top 10'; } else { $orderby = 'ORDER BY _quota_cur DESC'; $countcurr_str = 'Count curr.'; $quotacurr_str = 'Quota curr.'; $top10_str = 'top 10'; } } } else $orderby .= ' LIMIT 10'; echo "
". ""; $query = 'SELECT * FROM throttle '.$orderby; $ret = mysql_query($query); while ($row = mysql_fetch_assoc($ret)) { # defcon colour if(($row['_count_cur'] >= $row['_count_max']) or ($row['_quota_cur'] >= $row['_quota_max'])) $bg = 'red'; elseif(($row['_count_cur'] >= $row['_count_max']/2) or ($row['_quota_cur'] >= $row['_quota_max']/2)) $bg = 'yellow'; else $bg = 'lightgreen'; # human date $date = date("D, d M Y", $row['_date']); $time = date("H:i:s", $row['_date']); echo ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''; } mysql_close($link); ?>
relaycp ($top10_str, $all_str)
UserCount max.$countcurr_strQuota max.$quotacurr_strLast resetApply
'.$row['_from'].'
'.$row['_count_cur'].''.$row['_quota_max'].''.$row['_quota_cur'].''.$date.', a les '.$time.'
Llegenda:

Count max.: Maximum allowed mails sent (only editable field).
Count curr.: Number of current mails sent (refresh to update).
Quota max.: Maximum allowed size of mails sent.
Quota curr.: Number of current size of mail sent (refresh to update).
Last reset: Date in which counters (Count curr. i Quota curr.) were set to 0.
xifra: Quota max. reached, sending is blocked.
xifra: Quota curr. between half and maximum.
xifra: Quota curr. below half Quota max.