steviez Posted November 23, 2007 Share Posted November 23, 2007 Hi, I am trying to make my code work, if my users have a quota limit of say 100MB and they try to upload a file bigger than what quota they have left i need it to not allow then to do so. My code so far for their quota: <?php // Select Total Space Used $sql = "SELECT SUM(size) AS sum_size FROM `uploads` WHERE uploader = '".$user_name."' "; $result = mysql_query($sql) or die(mysql_error()); $i = mysql_fetch_array($result); $space_used = $i['sum_size']; $max_space = $settings['max_free_space'] * 1024 *1024; //100MB // If Over Account Quota if($space_used > $max_space){ $over_use = true; }else{ $over_use = false; } $smarty->assign("over_use", $over_use); // Show Space Used As % $smarty->assign("used",number_format($space_used/$max_space*100,0)."%"); $smarty->assign("used_sub",ByteSize($space_used)." out of allowed ".ByteSize($max_space)); ?> Is this possable? Quote Link to comment Share on other sites More sharing options...
xyn Posted December 5, 2007 Share Posted December 5, 2007 1. collect all their files they have. 2. add the file sizes up. 3. subtract step 2 by the 100mb limit. 4. if statement, to check their new file is less than or equal to step 3 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.