$bar_width = round((1 - intval($master_array[$i][3]) / intval($master_array[$i][1])) * 148); $free_percent = $master_array[$i][3] / $master_array[$i][1] * 100; $used_percent = 100 - $free_percent; $bar_width = 1.48 * $used_percent; if ($used_percent > 90) { echo '<span style="display:block; height:11px; width:' . $bar_width . 'px; background-color:#DA2626"></span>'; // Red bar } else { echo '<span style="display:block; height:11px; width:' . $bar_width . 'px; background-color:#26A0DA"></span>'; // Blue bar } } // linux resutls are in kbyte blocks if (php_uname('s') != 'Windows NT') { $master_array[$i][3] = $master_array[$i][3] * 1024; $master_array[$i][1] = $master_array[$i][1] * 1024; } echo '</span><span style="color:#808080">' . sprintf($string['freespace'], format_space($master_array[$i][3]), format_space($master_array[$i][1])) . '</span></td></tr>'; } } echo '</table></td></tr>'; echo "</table>\n<br />\n"; $mysqli->close(); ?> </td></tr> </table> </div> </div> </body> </html>
function format_list($string) { $string = str_replace(";", " ", $string); return format_space($string); }