Files
phpmyadmin/libraries/db_table_exists.lib.php
Garvin Hicking f0da471ec3 /libraries cleanup hopefully done. Double-Checked every change, my installation still works. ;)
Will continue working on remaining files tomorrow and hope to make it to the end of the next day.
2003-11-20 16:31:51 +00:00

37 lines
1.3 KiB
PHP

<?php
/* $Id$ */
// vim: expandtab sw=4 ts=4 sts=4:
/**
* Ensure the database and the table exist (else move to the "parent" script)
* and display headers
*/
if (!isset($is_db) || !$is_db) {
// Not a valid db name -> back to the welcome page
if (!empty($db)) {
$is_db = @PMA_mysql_select_db($db);
}
if (empty($db) || !$is_db) {
if (!isset($is_transformation_wrapper)) {
header('Location: ' . $cfg['PmaAbsoluteUri'] . 'main.php?' . PMA_generate_common_url('', '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
}
exit();
}
} // end if (ensures db exists)
if (!isset($is_table) || !$is_table) {
// Not a valid table name -> back to the db_details.php
if (!empty($table)) {
$is_table = @PMA_mysql_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'');
}
if (empty($table)
|| !($is_table && @mysql_numrows($is_table))) {
if (!isset($is_transformation_wrapper)) {
header('Location: ' . $cfg['PmaAbsoluteUri'] . 'db_details.php?' . PMA_generate_common_url($db, '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
}
exit();
} else if (isset($is_table)) {
mysql_free_result($is_table);
}
} // end if (ensures table exists)
?>