PHP - space

Discussion in 'General' started by alexillsley, Feb 10, 2007.

  1. alexillsley

    alexillsley New Member

    How can I get how much space a site has left in php? Is it in the sql database?
    Thanks,
    Alex
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Every site has its own group. You can either use the repquota command for the group or you use the du command on the website directory.
     
  3. alexillsley

    alexillsley New Member

    Thanks till,

    I made a function to get how big a site is
    PHP:
    <?php
    echo site_space("test.com");


    function 
    site_space($site) {
    $site=str_replace("..","",$site);
    return 
    shell_exec("du -s /srv/www/".$site."/");
    }
    ?> 
    Just need to get the users total space and subtract that off it
     
  4. alexillsley

    alexillsley New Member

    Why wont the following php code return the users total allowed space??
    PHP:
    <?php
    echo total_space("***","***");

    function 
    total_space($host,$domain) {
    mysql_connect("localhost","***","*****");
    mysql_selectdb("ispconfig_db");
    $sql 'SELECT `web_traffic` FROM `isp_isp_web` WHERE `web_domain`=\''.$domain.'\' and `web_host`=\''.$host.'\'';
    return 
    mysql_query($sql);
    mysql_close();
    }
    ?>
     
  5. alexillsley

    alexillsley New Member

    FIXED:)
    Thanks,
    Alex
     

Share This Page