Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: disk usage

  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    disk usage

    hi everyone,

    i am stuck in a situation, kindly help.

    i am making a system in which there is multiple login (just like yahoo mail), now fixed disk quota has been assigned to the users (5 mb), users are allowed to upload certain images in their respective folders. now i want that the total size of the folder does not exceed the 5 mb limit. how can i know that user's folder has occupied n number of bytes or n number or MB of space.

    i want to show to the user that - you have consumed this much % of space, just like yahoo mail shows.

    Thanks
    Gaurav

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    not sure if PHP's disk_free_space() will be of any use , probably not

    else use the shell ,
    PHP Code:
    <?
    exec
    ('du -hs /home/user/mail/directory',$yaks);
    print_r($yaks);
    ?>
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    And a note about using php to run system commands. If you're going to use user data, (POST, GET info for example) make sure the input is clean.

    Otherwise you could end up with something like this...
    Code:
    $cmd = $_GET['command'];
    exec($cmd,$yaks);
    print_r($yaks);
    And the user types:
    http://mysite.com/script.php?command=rm%20-rf%20/

    And they just deleted your file system!

  • #4
    New Coder
    Join Date
    May 2004
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts
    webmin has function to show this data. It uses cgi-scripts (perl I think).
    But that runs as root, so I don't know about running it as the webservers' user.
    maybe you could take a look at the webmin-code

  • #5
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    .. I doubt that webmin does any more than execute 'du' ?

    also Bcarls point is very important , something I really should have noted
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •