Merge pull request #14993 from bahl24/fix-#14934
[phpmyadmin.git] / import.php
blob7bd3b8f2d3f2e5c30ef401797ed6bc750a770ff0
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Core script for import, this is just the glue around all other stuff
6 * @package PhpMyAdmin
7 */
9 use PhpMyAdmin\Bookmark;
10 use PhpMyAdmin\Core;
11 use PhpMyAdmin\Encoding;
12 use PhpMyAdmin\File;
13 use PhpMyAdmin\Import;
14 use PhpMyAdmin\ParseAnalyze;
15 use PhpMyAdmin\Plugins;
16 use PhpMyAdmin\Plugins\ImportPlugin;
17 use PhpMyAdmin\Response;
18 use PhpMyAdmin\Sql;
19 use PhpMyAdmin\Url;
20 use PhpMyAdmin\Util;
22 /* Enable LOAD DATA LOCAL INFILE for LDI plugin */
23 if (isset($_POST['format']) && $_POST['format'] == 'ldi') {
24 define('PMA_ENABLE_LDI', 1);
27 /**
28 * Get the variables sent or posted to this script and a core script
30 require_once 'libraries/common.inc.php';
32 if (isset($_POST['show_as_php'])) {
33 $GLOBALS['show_as_php'] = $_POST['show_as_php'];
36 // If there is a request to 'Simulate DML'.
37 if (isset($_POST['simulate_dml'])) {
38 Import::handleSimulateDmlRequest();
39 exit;
42 $response = Response::getInstance();
44 $sql = new Sql();
46 // If it's a refresh console bookmarks request
47 if (isset($_GET['console_bookmark_refresh'])) {
48 $response->addJSON(
49 'console_message_bookmark', PhpMyAdmin\Console::getBookmarkContent()
51 exit;
53 // If it's a console bookmark add request
54 if (isset($_POST['console_bookmark_add'])) {
55 if (isset($_POST['label']) && isset($_POST['db'])
56 && isset($_POST['bookmark_query']) && isset($_POST['shared'])
57 ) {
58 $cfgBookmark = Bookmark::getParams($GLOBALS['cfg']['Server']['user']);
59 $bookmarkFields = array(
60 'bkm_database' => $_POST['db'],
61 'bkm_user' => $cfgBookmark['user'],
62 'bkm_sql_query' => $_POST['bookmark_query'],
63 'bkm_label' => $_POST['label']
65 $isShared = ($_POST['shared'] == 'true' ? true : false);
66 $bookmark = Bookmark::createBookmark(
67 $GLOBALS['dbi'],
68 $GLOBALS['cfg']['Server']['user'],
69 $bookmarkFields,
70 $isShared
72 if ($bookmark !== false && $bookmark->save()) {
73 $response->addJSON('message', __('Succeeded'));
74 $response->addJSON('data', $bookmarkFields);
75 $response->addJSON('isShared', $isShared);
76 } else {
77 $response->addJSON('message', __('Failed'));
79 die();
80 } else {
81 $response->addJSON('message', __('Incomplete params'));
82 die();
86 $format = '';
88 /**
89 * Sets globals from $_POST
91 $post_params = array(
92 'charset_of_file',
93 'format',
94 'import_type',
95 'is_js_confirmed',
96 'MAX_FILE_SIZE',
97 'message_to_show',
98 'noplugin',
99 'skip_queries',
100 'local_import_file'
103 foreach ($post_params as $one_post_param) {
104 if (isset($_POST[$one_post_param])) {
105 $GLOBALS[$one_post_param] = $_POST[$one_post_param];
109 // reset import messages for ajax request
110 $_SESSION['Import_message']['message'] = null;
111 $_SESSION['Import_message']['go_back_url'] = null;
112 // default values
113 $GLOBALS['reload'] = false;
115 // Use to identify current cycle is executing
116 // a multiquery statement or stored routine
117 if (!isset($_SESSION['is_multi_query'])) {
118 $_SESSION['is_multi_query'] = false;
121 $ajax_reload = array();
122 // Are we just executing plain query or sql file?
123 // (eg. non import, but query box/window run)
124 if (! empty($sql_query)) {
126 // apply values for parameters
127 if (! empty($_POST['parameterized'])
128 && ! empty($_POST['parameters'])
129 && is_array($_POST['parameters'])
131 $parameters = $_POST['parameters'];
132 foreach ($parameters as $parameter => $replacement) {
133 $quoted = preg_quote($parameter, '/');
134 // making sure that :param does not apply values to :param1
135 $sql_query = preg_replace(
136 '/' . $quoted . '([^a-zA-Z0-9_])/',
137 $GLOBALS['dbi']->escapeString($replacement) . '${1}',
138 $sql_query
140 // for parameters the appear at the end of the string
141 $sql_query = preg_replace(
142 '/' . $quoted . '$/',
143 $GLOBALS['dbi']->escapeString($replacement),
144 $sql_query
149 // run SQL query
150 $import_text = $sql_query;
151 $import_type = 'query';
152 $format = 'sql';
153 $_SESSION['sql_from_query_box'] = true;
155 // If there is a request to ROLLBACK when finished.
156 if (isset($_POST['rollback_query'])) {
157 Import::handleRollbackRequest($import_text);
160 // refresh navigation and main panels
161 if (preg_match('/^(DROP)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i', $sql_query)) {
162 $GLOBALS['reload'] = true;
163 $ajax_reload['reload'] = true;
166 // refresh navigation panel only
167 if (preg_match(
168 '/^(CREATE|ALTER)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i',
169 $sql_query
170 )) {
171 $ajax_reload['reload'] = true;
174 // do a dynamic reload if table is RENAMED
175 // (by sending the instruction to the AJAX response handler)
176 if (preg_match(
177 '/^RENAME\s+TABLE\s+(.*?)\s+TO\s+(.*?)($|;|\s)/i',
178 $sql_query,
179 $rename_table_names
180 )) {
181 $ajax_reload['reload'] = true;
182 $ajax_reload['table_name'] = PhpMyAdmin\Util::unQuote(
183 $rename_table_names[2]
187 $sql_query = '';
188 } elseif (! empty($sql_file)) {
189 // run uploaded SQL file
190 $import_file = $sql_file;
191 $import_type = 'queryfile';
192 $format = 'sql';
193 unset($sql_file);
194 } elseif (! empty($_POST['id_bookmark'])) {
195 // run bookmark
196 $import_type = 'query';
197 $format = 'sql';
200 // If we didn't get any parameters, either user called this directly, or
201 // upload limit has been reached, let's assume the second possibility.
202 if ($_POST == array() && $_GET == array()) {
203 $message = PhpMyAdmin\Message::error(
205 'You probably tried to upload a file that is too large. Please refer ' .
206 'to %sdocumentation%s for a workaround for this limit.'
209 $message->addParam('[doc@faq1-16]');
210 $message->addParam('[/doc]');
212 // so we can obtain the message
213 $_SESSION['Import_message']['message'] = $message->getDisplay();
214 $_SESSION['Import_message']['go_back_url'] = $GLOBALS['goto'];
216 $response->setRequestStatus(false);
217 $response->addJSON('message', $message);
219 exit; // the footer is displayed automatically
222 // Add console message id to response output
223 if (isset($_POST['console_message_id'])) {
224 $response->addJSON('console_message_id', $_POST['console_message_id']);
228 * Sets globals from $_POST patterns, for import plugins
229 * We only need to load the selected plugin
232 if (! in_array(
233 $format,
234 array(
235 'csv',
236 'ldi',
237 'mediawiki',
238 'ods',
239 'shp',
240 'sql',
241 'xml'
245 // this should not happen for a normal user
246 // but only during an attack
247 Core::fatalError('Incorrect format parameter');
250 $post_patterns = array(
251 '/^force_file_/',
252 '/^' . $format . '_/'
255 Core::setPostAsGlobal($post_patterns);
257 // Check needed parameters
258 PhpMyAdmin\Util::checkParameters(array('import_type', 'format'));
260 // We don't want anything special in format
261 $format = Core::securePath($format);
263 if (strlen($table) > 0 && strlen($db) > 0) {
264 $urlparams = array('db' => $db, 'table' => $table);
265 } elseif (strlen($db) > 0) {
266 $urlparams = array('db' => $db);
267 } else {
268 $urlparams = array();
271 // Create error and goto url
272 if ($import_type == 'table') {
273 $goto = 'tbl_import.php';
274 } elseif ($import_type == 'database') {
275 $goto = 'db_import.php';
276 } elseif ($import_type == 'server') {
277 $goto = 'server_import.php';
278 } else {
279 if (empty($goto) || !preg_match('@^(server|db|tbl)(_[a-z]*)*\.php$@i', $goto)) {
280 if (strlen($table) > 0 && strlen($db) > 0) {
281 $goto = 'tbl_structure.php';
282 } elseif (strlen($db) > 0) {
283 $goto = 'db_structure.php';
284 } else {
285 $goto = 'server_sql.php';
289 $err_url = $goto . Url::getCommon($urlparams);
290 $_SESSION['Import_message']['go_back_url'] = $err_url;
291 // Avoid setting selflink to 'import.php'
292 // problem similar to bug 4276
293 if (basename($_SERVER['SCRIPT_NAME']) === 'import.php') {
294 $_SERVER['SCRIPT_NAME'] = $goto;
298 if (strlen($db) > 0) {
299 $GLOBALS['dbi']->selectDb($db);
302 Util::setTimeLimit();
303 if (! empty($cfg['MemoryLimit'])) {
304 ini_set('memory_limit', $cfg['MemoryLimit']);
307 $timestamp = time();
308 if (isset($_POST['allow_interrupt'])) {
309 $maximum_time = ini_get('max_execution_time');
310 } else {
311 $maximum_time = 0;
314 // set default values
315 $timeout_passed = false;
316 $error = false;
317 $read_multiply = 1;
318 $finished = false;
319 $offset = 0;
320 $max_sql_len = 0;
321 $file_to_unlink = '';
322 $sql_query = '';
323 $sql_query_disabled = false;
324 $go_sql = false;
325 $executed_queries = 0;
326 $run_query = true;
327 $charset_conversion = false;
328 $reset_charset = false;
329 $bookmark_created = false;
330 $result = false;
331 $msg = 'Sorry an unexpected error happened!';
333 // Bookmark Support: get a query back from bookmark if required
334 if (! empty($_POST['id_bookmark'])) {
335 $id_bookmark = (int)$_POST['id_bookmark'];
336 switch ($_POST['action_bookmark']) {
337 case 0: // bookmarked query that have to be run
338 $bookmark = Bookmark::get(
339 $GLOBALS['dbi'],
340 $GLOBALS['cfg']['Server']['user'],
341 $db,
342 $id_bookmark,
343 'id',
344 isset($_POST['action_bookmark_all'])
347 if (! empty($_POST['bookmark_variable'])) {
348 $import_text = $bookmark->applyVariables(
349 $_POST['bookmark_variable']
351 } else {
352 $import_text = $bookmark->getQuery();
355 // refresh navigation and main panels
356 if (preg_match(
357 '/^(DROP)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i',
358 $import_text
359 )) {
360 $GLOBALS['reload'] = true;
361 $ajax_reload['reload'] = true;
364 // refresh navigation panel only
365 if (preg_match(
366 '/^(CREATE|ALTER)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i',
367 $import_text
370 $ajax_reload['reload'] = true;
372 break;
373 case 1: // bookmarked query that have to be displayed
374 $bookmark = Bookmark::get(
375 $GLOBALS['dbi'],
376 $GLOBALS['cfg']['Server']['user'],
377 $db,
378 $id_bookmark
380 $import_text = $bookmark->getQuery();
381 if ($response->isAjax()) {
382 $message = PhpMyAdmin\Message::success(__('Showing bookmark'));
383 $response->setRequestStatus($message->isSuccess());
384 $response->addJSON('message', $message);
385 $response->addJSON('sql_query', $import_text);
386 $response->addJSON('action_bookmark', $_POST['action_bookmark']);
387 exit;
388 } else {
389 $run_query = false;
391 break;
392 case 2: // bookmarked query that have to be deleted
393 $bookmark = Bookmark::get(
394 $GLOBALS['dbi'],
395 $GLOBALS['cfg']['Server']['user'],
396 $db,
397 $id_bookmark
399 if (! empty($bookmark)) {
400 $bookmark->delete();
401 if ($response->isAjax()) {
402 $message = PhpMyAdmin\Message::success(
403 __('The bookmark has been deleted.')
405 $response->setRequestStatus($message->isSuccess());
406 $response->addJSON('message', $message);
407 $response->addJSON('action_bookmark', $_POST['action_bookmark']);
408 $response->addJSON('id_bookmark', $id_bookmark);
409 exit;
410 } else {
411 $run_query = false;
412 $error = true; // this is kind of hack to skip processing the query
416 break;
418 } // end bookmarks reading
420 // Do no run query if we show PHP code
421 if (isset($GLOBALS['show_as_php'])) {
422 $run_query = false;
423 $go_sql = true;
426 // We can not read all at once, otherwise we can run out of memory
427 $memory_limit = trim(ini_get('memory_limit'));
428 // 2 MB as default
429 if (empty($memory_limit)) {
430 $memory_limit = 2 * 1024 * 1024;
432 // In case no memory limit we work on 10MB chunks
433 if ($memory_limit == -1) {
434 $memory_limit = 10 * 1024 * 1024;
437 // Calculate value of the limit
438 $memoryUnit = mb_strtolower(substr($memory_limit, -1));
439 if ('m' == $memoryUnit) {
440 $memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024;
441 } elseif ('k' == $memoryUnit) {
442 $memory_limit = (int)substr($memory_limit, 0, -1) * 1024;
443 } elseif ('g' == $memoryUnit) {
444 $memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024 * 1024;
445 } else {
446 $memory_limit = (int)$memory_limit;
449 // Just to be sure, there might be lot of memory needed for uncompression
450 $read_limit = $memory_limit / 8;
452 // handle filenames
453 if (isset($_FILES['import_file'])) {
454 $import_file = $_FILES['import_file']['tmp_name'];
456 if (! empty($local_import_file) && ! empty($cfg['UploadDir'])) {
458 // sanitize $local_import_file as it comes from a POST
459 $local_import_file = Core::securePath($local_import_file);
461 $import_file = PhpMyAdmin\Util::userDir($cfg['UploadDir'])
462 . $local_import_file;
465 * Do not allow symlinks to avoid security issues
466 * (user can create symlink to file he can not access,
467 * but phpMyAdmin can).
469 if (@is_link($import_file)) {
470 $import_file = 'none';
473 } elseif (empty($import_file) || ! is_uploaded_file($import_file)) {
474 $import_file = 'none';
477 // Do we have file to import?
479 if ($import_file != 'none' && ! $error) {
481 * Handle file compression
483 $import_handle = new File($import_file);
484 $import_handle->checkUploadedFile();
485 if ($import_handle->isError()) {
486 Import::stop($import_handle->getError());
488 $import_handle->setDecompressContent(true);
489 $import_handle->open();
490 if ($import_handle->isError()) {
491 Import::stop($import_handle->getError());
493 } elseif (! $error) {
494 if (! isset($import_text) || empty($import_text)) {
495 $message = PhpMyAdmin\Message::error(
497 'No data was received to import. Either no file name was ' .
498 'submitted, or the file size exceeded the maximum size permitted ' .
499 'by your PHP configuration. See [doc@faq1-16]FAQ 1.16[/doc].'
502 Import::stop($message);
506 // so we can obtain the message
507 //$_SESSION['Import_message'] = $message->getDisplay();
509 // Convert the file's charset if necessary
510 if (Encoding::isSupported() && isset($charset_of_file)) {
511 if ($charset_of_file != 'utf-8') {
512 $charset_conversion = true;
514 } elseif (isset($charset_of_file) && $charset_of_file != 'utf-8') {
515 $GLOBALS['dbi']->query('SET NAMES \'' . $charset_of_file . '\'');
516 // We can not show query in this case, it is in different charset
517 $sql_query_disabled = true;
518 $reset_charset = true;
521 // Something to skip? (because timeout has passed)
522 if (! $error && isset($_POST['skip'])) {
523 $original_skip = $skip = intval($_POST['skip']);
524 while ($skip > 0 && ! $finished) {
525 Import::getNextChunk($skip < $read_limit ? $skip : $read_limit);
526 // Disable read progressivity, otherwise we eat all memory!
527 $read_multiply = 1;
528 $skip -= $read_limit;
530 unset($skip);
533 // This array contain the data like numberof valid sql queries in the statement
534 // and complete valid sql statement (which affected for rows)
535 $sql_data = array('valid_sql' => array(), 'valid_queries' => 0);
537 if (! $error) {
538 /* @var $import_plugin ImportPlugin */
539 $import_plugin = Plugins::getPlugin(
540 "import",
541 $format,
542 'libraries/classes/Plugins/Import/',
543 $import_type
545 if ($import_plugin == null) {
546 $message = PhpMyAdmin\Message::error(
547 __('Could not load import plugins, please check your installation!')
549 Import::stop($message);
550 } else {
551 // Do the real import
552 try {
553 $default_fk_check = PhpMyAdmin\Util::handleDisableFKCheckInit();
554 $import_plugin->doImport($sql_data);
555 PhpMyAdmin\Util::handleDisableFKCheckCleanup($default_fk_check);
556 } catch (Exception $e) {
557 PhpMyAdmin\Util::handleDisableFKCheckCleanup($default_fk_check);
558 throw $e;
563 if (isset($import_handle)) {
564 $import_handle->close();
567 // Cleanup temporary file
568 if ($file_to_unlink != '') {
569 unlink($file_to_unlink);
572 // Reset charset back, if we did some changes
573 if ($reset_charset) {
574 $GLOBALS['dbi']->query('SET CHARACTER SET ' . $GLOBALS['charset_connection']);
575 $GLOBALS['dbi']->setCollation($collation_connection);
578 // Show correct message
579 if (! empty($id_bookmark) && $_POST['action_bookmark'] == 2) {
580 $message = PhpMyAdmin\Message::success(__('The bookmark has been deleted.'));
581 $display_query = $import_text;
582 $error = false; // unset error marker, it was used just to skip processing
583 } elseif (! empty($id_bookmark) && $_POST['action_bookmark'] == 1) {
584 $message = PhpMyAdmin\Message::notice(__('Showing bookmark'));
585 } elseif ($bookmark_created) {
586 $special_message = '[br]' . sprintf(
587 __('Bookmark %s has been created.'),
588 htmlspecialchars($_POST['bkm_label'])
590 } elseif ($finished && ! $error) {
591 // Do not display the query with message, we do it separately
592 $display_query = ';';
593 if ($import_type != 'query') {
594 $message = PhpMyAdmin\Message::success(
595 '<em>'
596 . _ngettext(
597 'Import has been successfully finished, %d query executed.',
598 'Import has been successfully finished, %d queries executed.',
599 $executed_queries
601 . '</em>'
603 $message->addParam($executed_queries);
605 if (! empty($import_notice)) {
606 $message->addHtml($import_notice);
608 if (! empty($local_import_file)) {
609 $message->addText('(' . $local_import_file . ')');
610 } else {
611 $message->addText('(' . $_FILES['import_file']['name'] . ')');
616 // Did we hit timeout? Tell it user.
617 if ($timeout_passed) {
618 $urlparams['timeout_passed'] = '1';
619 $urlparams['offset'] = $GLOBALS['offset'];
620 if (isset($local_import_file)) {
621 $urlparams['local_import_file'] = $local_import_file;
624 $importUrl = $err_url = $goto . Url::getCommon($urlparams);
626 $message = PhpMyAdmin\Message::error(
628 'Script timeout passed, if you want to finish import,'
629 . ' please %sresubmit the same file%s and import will resume.'
632 $message->addParamHtml('<a href="' . $importUrl . '">');
633 $message->addParamHtml('</a>');
635 if ($offset == 0 || (isset($original_skip) && $original_skip == $offset)) {
636 $message->addText(
638 'However on last run no data has been parsed,'
639 . ' this usually means phpMyAdmin won\'t be able to'
640 . ' finish this import unless you increase php time limits.'
646 // if there is any message, copy it into $_SESSION as well,
647 // so we can obtain it by AJAX call
648 if (isset($message)) {
649 $_SESSION['Import_message']['message'] = $message->getDisplay();
651 // Parse and analyze the query, for correct db and table name
652 // in case of a query typed in the query window
653 // (but if the query is too large, in case of an imported file, the parser
654 // can choke on it so avoid parsing)
655 $sqlLength = mb_strlen($sql_query);
656 if ($sqlLength <= $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
657 list(
658 $analyzed_sql_results,
659 $db,
660 $table_from_sql
661 ) = ParseAnalyze::sqlQuery($sql_query, $db);
662 // @todo: possibly refactor
663 extract($analyzed_sql_results);
665 if ($table != $table_from_sql && !empty($table_from_sql)) {
666 $table = $table_from_sql;
670 // There was an error?
671 if (isset($my_die)) {
672 foreach ($my_die as $key => $die) {
673 PhpMyAdmin\Util::mysqlDie(
674 $die['error'], $die['sql'], false, $err_url, $error
679 if ($go_sql) {
681 if (! empty($sql_data) && ($sql_data['valid_queries'] > 1)) {
682 $_SESSION['is_multi_query'] = true;
683 $sql_queries = $sql_data['valid_sql'];
684 } else {
685 $sql_queries = array($sql_query);
688 $html_output = '';
690 foreach ($sql_queries as $sql_query) {
692 // parse sql query
693 list(
694 $analyzed_sql_results,
695 $db,
696 $table_from_sql
697 ) = ParseAnalyze::sqlQuery($sql_query, $db);
698 // @todo: possibly refactor
699 extract($analyzed_sql_results);
701 // Check if User is allowed to issue a 'DROP DATABASE' Statement
702 if ($sql->hasNoRightsToDropDatabase(
703 $analyzed_sql_results, $cfg['AllowUserDropDatabase'], $GLOBALS['dbi']->isSuperuser()
704 )) {
705 PhpMyAdmin\Util::mysqlDie(
706 __('"DROP DATABASE" statements are disabled.'),
708 false,
709 $_SESSION['Import_message']['go_back_url']
711 return;
712 } // end if
714 if ($table != $table_from_sql && !empty($table_from_sql)) {
715 $table = $table_from_sql;
718 $html_output .= $sql->executeQueryAndGetQueryResponse(
719 $analyzed_sql_results, // analyzed_sql_results
720 false, // is_gotofile
721 $db, // db
722 $table, // table
723 null, // find_real_end
724 null, // sql_query_for_bookmark - see below
725 null, // extra_data
726 null, // message_to_show
727 null, // message
728 null, // sql_data
729 $goto, // goto
730 $pmaThemeImage, // pmaThemeImage
731 null, // disp_query
732 null, // disp_message
733 null, // query_type
734 $sql_query, // sql_query
735 null, // selectedTables
736 null // complete_query
740 // sql_query_for_bookmark is not included in Sql::executeQueryAndGetQueryResponse
741 // since only one bookmark has to be added for all the queries submitted through
742 // the SQL tab
743 if (! empty($_POST['bkm_label']) && ! empty($import_text)) {
744 $cfgBookmark = Bookmark::getParams($GLOBALS['cfg']['Server']['user']);
745 $sql->storeTheQueryAsBookmark(
746 $db, $cfgBookmark['user'],
747 $_POST['sql_query'], $_POST['bkm_label'],
748 isset($_POST['bkm_replace']) ? $_POST['bkm_replace'] : null
752 $response->addJSON('ajax_reload', $ajax_reload);
753 $response->addHTML($html_output);
754 exit();
756 } elseif ($result) {
757 // Save a Bookmark with more than one queries (if Bookmark label given).
758 if (! empty($_POST['bkm_label']) && ! empty($import_text)) {
759 $cfgBookmark = Bookmark::getParams($GLOBALS['cfg']['Server']['user']);
760 $sql->storeTheQueryAsBookmark(
761 $db, $cfgBookmark['user'],
762 $_POST['sql_query'], $_POST['bkm_label'],
763 isset($_POST['bkm_replace']) ? $_POST['bkm_replace'] : null
767 $response->setRequestStatus(true);
768 $response->addJSON('message', PhpMyAdmin\Message::success($msg));
769 $response->addJSON(
770 'sql_query',
771 PhpMyAdmin\Util::getMessage($msg, $sql_query, 'success')
773 } elseif ($result == false) {
774 $response->setRequestStatus(false);
775 $response->addJSON('message', PhpMyAdmin\Message::error($msg));
776 } else {
777 $active_page = $goto;
778 include '' . $goto;
781 // If there is request for ROLLBACK in the end.
782 if (isset($_POST['rollback_query'])) {
783 $GLOBALS['dbi']->query('ROLLBACK');