path disclosure
[phpmyadmin/crack.git] / db_details_db_info.php3
blob4c4a27ef9afd00c200445954ce65a11b18fde2ce
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 // Check parameters
8 if (!defined('PMA_COMMON_LIB_INCLUDED')) {
9 include('./libraries/common.lib.php3');
12 PMA_checkParameters(array('db'));
15 /**
16 * Gets the list of the table in the current db and informations about these
17 * tables if possible
19 // staybyte: speedup view on locked tables - 11 June 2001
20 $tables = array();
21 if (PMA_MYSQL_INT_VERSION >= 32303) {
22 // Special speedup for newer MySQL Versions (in 4.0 format changed)
23 if ($cfg['SkipLockedTables'] == TRUE && PMA_MYSQL_INT_VERSION >= 32330) {
24 $local_query = 'SHOW OPEN TABLES FROM ' . PMA_backquote($db);
25 $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
26 // Blending out tables in use
27 if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
28 while ($tmp = PMA_mysql_fetch_row($db_info_result)) {
29 // if in use memorize tablename
30 if (eregi('in_use=[1-9]+', $tmp[1])) {
31 $sot_cache[$tmp[0]] = TRUE;
34 mysql_free_result($db_info_result);
36 if (isset($sot_cache)) {
37 $local_query = 'SHOW TABLES FROM ' . PMA_backquote($db);
38 $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
39 if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
40 while ($tmp = PMA_mysql_fetch_row($db_info_result)) {
41 if (!isset($sot_cache[$tmp[0]])) {
42 $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\'';
43 $sts_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
44 $sts_tmp = PMA_mysql_fetch_array($sts_result);
45 $tables[] = $sts_tmp;
46 } else { // table in use
47 $tables[] = array('Name' => $tmp[0]);
50 mysql_free_result($db_info_result);
51 $sot_ready = TRUE;
56 if (!isset($sot_ready)) {
57 $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
58 $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
59 if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
60 while ($sts_tmp = PMA_mysql_fetch_array($db_info_result)) {
61 $tables[] = $sts_tmp;
63 mysql_free_result($db_info_result);
66 $num_tables = (isset($tables) ? count($tables) : 0);
67 } // end if (PMA_MYSQL_INT_VERSION >= 32303)
68 else {
69 $db_info_result = PMA_mysql_list_tables($db);
70 $num_tables = ($db_info_result) ? @mysql_numrows($db_info_result) : 0;
71 for ($i = 0; $i < $num_tables; $i++) {
72 $tables[] = PMA_mysql_tablename($db_info_result, $i);
74 mysql_free_result($db_info_result);
78 /**
79 * Displays top menu links
81 echo '<!-- Top menu links -->' . "\n";
82 require('./db_details_links.php3');