Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / usr / share / phpmyadmin / libraries / | server ip : 104.21.89.46 your ip : 108.162.241.198 H O M E |
Filename | /usr/share/phpmyadmin/libraries/db_table_exists.lib.php |
Size | 3.02 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 27-Apr-2025 10:12 |
Last modified | 05-Dec-2013 01:44 |
Last accessed | 05-Jul-2025 20:18 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Ensure the database and the table exist (else move to the "parent" script)
* and display headers
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
if (empty($is_db)) {
if (strlen($db)) {
$is_db = @PMA_DBI_select_db($db);
} else {
$is_db = false;
}
if (! $is_db) {
// not a valid db name -> back to the welcome page
if (! defined('IS_TRANSFORMATION_WRAPPER')) {
$response = PMA_Response::getInstance();
if ($response->isAjax()) {
$response->isSuccess(false);
$response->addJSON(
'message',
PMA_Message::error(__('No databases selected.'))
);
} else {
$url_params = array('reload' => 1);
if (isset($message)) {
$url_params['message'] = $message;
}
if (! empty($sql_query)) {
$url_params['sql_query'] = $sql_query;
}
if (isset($show_as_php)) {
$url_params['show_as_php'] = $show_as_php;
}
PMA_sendHeaderLocation(
$cfg['PmaAbsoluteUri'] . 'index.php'
. PMA_generate_common_url($url_params, '&')
);
}
exit;
}
}
} // end if (ensures db exists)
if (empty($is_table)
&& !defined('PMA_SUBMIT_MULT')
&& ! defined('TABLE_MAY_BE_ABSENT')
) {
// Not a valid table name -> back to the db_sql.php
if (strlen($table)) {
$is_table = isset(PMA_Table::$cache[$db][$table]);
if (! $is_table) {
$_result = PMA_DBI_try_query(
'SHOW TABLES LIKE \'' . PMA_Util::sqlAddSlashes($table, true) . '\';',
null, PMA_DBI_QUERY_STORE
);
$is_table = @PMA_DBI_num_rows($_result);
PMA_DBI_free_result($_result);
}
} else {
$is_table = false;
}
if (! $is_table) {
if (! defined('IS_TRANSFORMATION_WRAPPER')) {
if (strlen($table)) {
// SHOW TABLES doesn't show temporary tables, so try select
// (as it can happen just in case temporary table, it should be
// fast):
/**
* @todo should this check really
* only happen if IS_TRANSFORMATION_WRAPPER?
*/
$_result = PMA_DBI_try_query(
'SELECT COUNT(*) FROM ' . PMA_Util::backquote($table) . ';',
null,
PMA_DBI_QUERY_STORE
);
$is_table = ($_result && @PMA_DBI_num_rows($_result));
PMA_DBI_free_result($_result);
}
if (! $is_table) {
include './db_sql.php';
exit;
}
}
if (! $is_table) {
exit;
}
}
} // end if (ensures table exists)
?>
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Ensure the database and the table exist (else move to the "parent" script)
* and display headers
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
if (empty($is_db)) {
if (strlen($db)) {
$is_db = @PMA_DBI_select_db($db);
} else {
$is_db = false;
}
if (! $is_db) {
// not a valid db name -> back to the welcome page
if (! defined('IS_TRANSFORMATION_WRAPPER')) {
$response = PMA_Response::getInstance();
if ($response->isAjax()) {
$response->isSuccess(false);
$response->addJSON(
'message',
PMA_Message::error(__('No databases selected.'))
);
} else {
$url_params = array('reload' => 1);
if (isset($message)) {
$url_params['message'] = $message;
}
if (! empty($sql_query)) {
$url_params['sql_query'] = $sql_query;
}
if (isset($show_as_php)) {
$url_params['show_as_php'] = $show_as_php;
}
PMA_sendHeaderLocation(
$cfg['PmaAbsoluteUri'] . 'index.php'
. PMA_generate_common_url($url_params, '&')
);
}
exit;
}
}
} // end if (ensures db exists)
if (empty($is_table)
&& !defined('PMA_SUBMIT_MULT')
&& ! defined('TABLE_MAY_BE_ABSENT')
) {
// Not a valid table name -> back to the db_sql.php
if (strlen($table)) {
$is_table = isset(PMA_Table::$cache[$db][$table]);
if (! $is_table) {
$_result = PMA_DBI_try_query(
'SHOW TABLES LIKE \'' . PMA_Util::sqlAddSlashes($table, true) . '\';',
null, PMA_DBI_QUERY_STORE
);
$is_table = @PMA_DBI_num_rows($_result);
PMA_DBI_free_result($_result);
}
} else {
$is_table = false;
}
if (! $is_table) {
if (! defined('IS_TRANSFORMATION_WRAPPER')) {
if (strlen($table)) {
// SHOW TABLES doesn't show temporary tables, so try select
// (as it can happen just in case temporary table, it should be
// fast):
/**
* @todo should this check really
* only happen if IS_TRANSFORMATION_WRAPPER?
*/
$_result = PMA_DBI_try_query(
'SELECT COUNT(*) FROM ' . PMA_Util::backquote($table) . ';',
null,
PMA_DBI_QUERY_STORE
);
$is_table = ($_result && @PMA_DBI_num_rows($_result));
PMA_DBI_free_result($_result);
}
if (! $is_table) {
include './db_sql.php';
exit;
}
}
if (! $is_table) {
exit;
}
}
} // end if (ensures table exists)
?>