0) { // Get the valid databases list $num_dbs = count($dblist); $dbs = @mysql_list_dbs() or PMA_mysqlDie('', 'mysql_list_dbs()', '', 'main.php3?lang' . $lang . '&server=' . $server); while ($a_db = mysql_fetch_object($dbs)) { if (!$num_dbs) { $dblist[] = $a_db->Database; } else { $true_dblist[$a_db->Database] = ''; } } // end while mysql_free_result($dbs); if ($num_dbs && empty($true_dblist)) { $dblist = array(); } else if ($num_dbs) { for ($i = 0; $i < $num_dbs; $i++) { if (isset($true_dblist[$dblist[$i]])) { $dblist_valid[] = $dblist[$i]; } } if (isset($dblist_valid)) { $dblist = $dblist_valid; unset($dblist_valid); } else { $dblist = array(); } unset($true_dblist); } // Get the valid databases count $num_dbs = count($dblist); } else { $num_dbs = 0; } /** * Displays the page */ ?>



do the work */ if ($num_dbs > 0) { // Defines the urls used to sort the table $common_url = 'db_stats.php3?lang=' . $lang . '&server=' . $server; if (empty($sort_by)) { $sort_by = 'db_name'; $sort_order = 'asc'; } else if (empty($sort_order)) { $sort_order = (($sort_by == 'db_name') ? 'asc' : 'desc'); } $img_tag = ' ' . "\n" . ' ' . ''
                    . (($sort_order == 'asc') ? $strAscending : $strDescending) . ''; // Default order is ascending for db name, descending for sizes for ($i = 0; $i < 5; $i++) { $url_sort[$i]['order'] = (($i == 0) ? 'asc' : 'desc'); $url_sort[$i]['img_tag'] = ''; } if ($sort_by == 'db_name') { $url_sort[0]['order'] = (($sort_order == 'asc') ? 'desc' : 'asc'); $url_sort[0]['img_tag'] = $img_tag; $col = 'key'; // used in 'PMA_dbCmp()' } else if ($sort_by == 'tbl_cnt') { $url_sort[1]['order'] = (($sort_order == 'asc') ? 'desc' : 'asc'); $url_sort[1]['img_tag'] = $img_tag; $col = 0; } else if ($sort_by == 'data_sz') { $url_sort[2]['order'] = (($sort_order == 'asc') ? 'desc' : 'asc'); $url_sort[2]['img_tag'] = $img_tag; $col = 1; } else if ($sort_by == 'idx_sz') { $url_sort[3]['order'] = (($sort_order == 'asc') ? 'desc' : 'asc'); $url_sort[3]['img_tag'] = $img_tag; $col = 2; } else { $url_sort[4]['order'] = (($sort_order == 'asc') ? 'desc' : 'asc'); $url_sort[4]['img_tag'] = $img_tag; $col = 3; } ?>
= 32303) { $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db); $result = @mysql_query($local_query); // needs the "@" below otherwise, warnings in case of special DB names if (@mysql_num_rows($result)) { while ($row = mysql_fetch_array($result)) { $dbs_array[$db][1] += $row['Data_length']; $dbs_array[$db][2] += $row['Index_length']; } $dbs_array[$db][3] = $dbs_array[$db][1] + $dbs_array[$db][2]; $total_array[1] += $dbs_array[$db][1]; $total_array[2] += $dbs_array[$db][2]; $total_array[3] += $dbs_array[$db][3]; } // end if mysql_free_result($result); } // end if MySQL 3.23.03+ } // end for mysql_close(); // Sorts the dbs arrays uksort($dbs_array, 'PMA_dbCmp'); reset($dbs_array); // Displays the tables stats per database $i = 0; while (list($db_name, $db_prop) = each($dbs_array)) { $bgcolor = ($i % 2) ? $cfgBgcolorOne : $cfgBgcolorTwo; list($data_size, $data_unit) = PMA_formatByteDown($dbs_array[$db_name][1], 3, 1); list($idx_size, $idx_unit) = PMA_formatByteDown($dbs_array[$db_name][2], 3, 1); list($tot_size, $tot_unit) = PMA_formatByteDown($dbs_array[$db_name][3], 3, 1); echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; $i++; } // end while unset($dbs_array); // Displays the server stats list($data_size, $data_unit) = PMA_formatByteDown($total_array[1], 3, 1); list($idx_size, $idx_unit) = PMA_formatByteDown($total_array[2], 3, 1); list($tot_size, $tot_unit) = PMA_formatByteDown($total_array[3], 3, 1); echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo ' ' . "\n"; echo '
                     
' . "\n"; echo '   ' . "\n"; echo '  ' . htmlentities($db_name) . '  ' . $dbs_array[$db_name][0] . '  ' . $data_size . ' ' . $data_unit . '  ' . $idx_size . ' ' . $idx_unit . '  ' . $tot_size . ' ' . $tot_unit . ' 
  ' . $strSum . ': ' . $num_dbs . ' ' . $total_array[0] . '  ' . $data_size . ' ' . $data_unit . '  ' . $idx_size . ' ' . $idx_unit . '  ' . $tot_size . ' ' . $tot_unit . ' 
' . "\n"; echo ' ' . $strWithChecked . '' . "\n"; echo ' ' . $strWithChecked . '  ' . "\n"; echo '
' . "\n\n"; echo '
' . "\n"; unset($total_array); } // end if ($num_dbs > 0) /** * No database case */ else { ?>