Jason Wong wrote: > On Saturday 30 November 2002 21:47, [EMAIL PROTECTED] wrote: > > Dear all, > > > > How to write a Quota function with php code ? > > Require : different Server machine, userid and password also > > > > Mine is Linux Redhat system... > > if ($current > $quota) { echo "Quota exceeded"; } > > IOW please elaborate on what you're trying to do.
There is a php code from Internet, it is enable Quota function with wu-imap server, but I can't run it into my server ( Linux Redhat system ) like http://www.ita.org.mo/~edward/imp/screenshot.gif... if (!function_exists('imp_show_quota')) { function imp_show_quota ($imp) { $imap_admin = $imp['user']; $passwd_array = posix_getpwnam($imap_admin); $homedir = split("/", $passwd_array['dir']); $realname = split(",", $passwd_array['gecos']); $quota_html = '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td class="item"><table border="0" cellspacing="0" cellpadding="0" width="100%"><tr>'; $quota_html .= '<td align="left" class="header">Login: ' . $realname[0] . " (" . $imap_admin . ")" . '</td>'; $junk = exec("sudo quota -u $imap_admin | grep $homedir[1]", $quota_data,$return_code); if ($return_code == 0 && count($quota_data) == 1) { $splitted = split("[[:blank:]]+", trim($quota_data[0])); $taken = $splitted[1] / 1000 ; $total = $splitted[2] / 1000 ; $percent = $taken * 100 / $total ; if ($percent >= 90) { $class = 'quotaalert'; } elseif ($percent >= 80) { $class = 'quotawarn'; } else { $class = 'header'; } $quota_html .= '<td align="right" class="' . $class . '">'; $quota_html .= sprintf("Quota on /%s: %.1fMB/%.1fMB (%.1f%%)", $homedir[1], $taken, $total, $percent); } else { $quota_html .= '<td align="right" class="header">'; $quota_html .= "Quota not available"; } $quota_html .= '</td></tr></table></td></tr></table>'; return $quota_html; } } Thank for your help ! Edward. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php