for Loic
[phpmyadmin/crack.git] / tbl_rename.php3
blob6843a5f01a5db3b3c42ba541fedcc90b9e7397e1
1 <?php
2 /* $Id$ */
5 /**
6 * Gets some core libraries
7 */
8 require('./libraries/grab_globals.lib.php3');
9 $js_to_run = 'functions.js';
10 require('./libraries/common.lib.php3');
13 /**
14 * Defines the url to return to in case of error in a sql statement
16 $err_url = 'tbl_properties.php3'
17 . '?lang=' . $lang
18 . '&amp;convcharset=' . $convcharset
19 . '&amp;server=' . $server
20 . '&amp;db=' . urlencode($db)
21 . '&amp;table=' . urlencode($table);
24 /**
25 * A new name has been submitted -> do the work
27 if (isset($new_name) && trim($new_name) != '') {
28 $old_name = $table;
29 $table = $new_name;
30 if (get_magic_quotes_gpc()) {
31 $new_name = stripslashes($new_name);
34 // Ensure the target is valid
35 if (count($dblist) > 0 && PMA_isInto($db, $dblist) == -1) {
36 exit();
38 if (PMA_MYSQL_INT_VERSION < 32306) {
39 PMA_checkReservedWords($new_name, $err_url);
42 include('./header.inc.php3');
43 PMA_mysql_select_db($db);
44 $sql_query = 'ALTER TABLE ' . PMA_backquote($old_name) . ' RENAME ' . PMA_backquote($new_name);
45 $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
46 $message = sprintf($strRenameTableOK, $old_name, $table);
47 $reload = 1;
51 /**
52 * No new name for the table!
54 else {
55 include('./header.inc.php3');
56 PMA_mysqlDie($strTableEmpty, '', '', $err_url);
60 /**
61 * Back to the calling script
63 require('./tbl_properties.php3');