update
[phpmyadmin/crack.git] / tbl_rename.php3
blobe2ab1fc0a64ed120bc02019a7c3bb29d4bfda7c6
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'
18 . '?lang=' . $lang
19 . '&amp;convcharset=' . $convcharset
20 . '&amp;server=' . $server
21 . '&amp;db=' . urlencode($db)
22 . '&amp;table=' . urlencode($table);
25 /**
26 * A new name has been submitted -> do the work
28 if (isset($new_name) && trim($new_name) != '') {
29 $old_name = $table;
30 $table = $new_name;
31 if (get_magic_quotes_gpc()) {
32 $new_name = stripslashes($new_name);
35 // Ensure the target is valid
36 if (count($dblist) > 0 && PMA_isInto($db, $dblist) == -1) {
37 exit();
39 if (PMA_MYSQL_INT_VERSION < 32306) {
40 PMA_checkReservedWords($new_name, $err_url);
43 include('./header.inc.php3');
44 PMA_mysql_select_db($db);
45 $sql_query = 'ALTER TABLE ' . PMA_backquote($old_name) . ' RENAME ' . PMA_backquote($new_name);
46 $result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', '', '', $err_url);
47 $message = sprintf($strRenameTableOK, $old_name, $table);
48 $reload = 1;
52 /**
53 * No new name for the table!
55 else {
56 include('./header.inc.php3');
57 PMA_mysqlDie($strTableEmpty, '', '', $err_url);
61 /**
62 * Back to the calling script
64 require('./tbl_properties.php3');