Re: Disk Quota
| From: | Thomas Deliduka | Date: | Thu, 03 Aug 2000 14:09:38 +0000 |
| Subject: | Re: Disk Quota | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-9935@lists.php.net to get a copy of this message | ||
On 8/3/00 9:49 AM this was written:
> I would like to know how to display disk quota information on the Web (using
> PHP), so that my client can always check their quota limit via the web.
I just did this. I have a control panel I'm working on that tells a user how
much space he's taking up in a directory. This may not be efficient but it's
what I do.
$home = "/home/user"; // this is actually taken from a database record
$cmd = "/sbin/du -hs $home";
exec($cmd,$ex);
echo substr($ex[0], 0, strpos($ex[0],"/")-1);
This will display the value in like 26.5M or something like that.
If you want to subtract the MB from what their limit is you can strip off
the M and do the subtraction.
But, if htey have less than a MB in the directory it will show up as 300K so
you have to do a check for K or M to do the subtraction.
--
Thomas Deliduka
IT Manager
-------------------------
New Eve Media
The Solution To Your Internet Angst
http://www.neweve.com/