update
[phpmyadmin/crack.git] / tbl_rename.php3
blob07325999b2619b399bebee5efc79388136c4ebcb
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 /**
7 * Gets some core libraries
8 */
9 require('./libraries/grab_globals.lib.php3');
10 $js_to_run = 'functions.js';
11 require('./libraries/common.lib.php3');
14 /**
15 * Defines the url to return to in case of error in a sql statement
17 $err_url = 'tbl_properties.php3?' . PMA_generate_common_url($db, $table);
20 /**
21 * A new name has been submitted -> do the work
23 if (isset($new_name) && trim($new_name) != '') {
24 $old_name = $table;
25 $table = $new_name;
26 if (get_magic_quotes_gpc()) {
27 $new_name = stripslashes($new_name);
30 // Ensure the target is valid
31 if (count($dblist) > 0 && PMA_isInto($db, $dblist) == -1) {
32 exit();
34 if (PMA_MYSQL_INT_VERSION < 32306) {
35 PMA_checkReservedWords($new_name, $err_url);
38 include('./header.inc.php3');
39 PMA_mysql_select_db($db);
40 $sql_query = 'ALTER TABLE ' . PMA_backquote($old_name) . ' RENAME ' . PMA_backquote($new_name);
41 $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
42 $message = sprintf($strRenameTableOK, $old_name, $table);
43 $reload = 1;
47 /**
48 * No new name for the table!
50 else {
51 include('./header.inc.php3');
52 PMA_mysqlDie($strTableEmpty, '', '', $err_url);
56 /**
57 * Back to the calling script
59 require('./tbl_properties.php3');