patch #1250935, interface improvements
[phpmyadmin/crack.git] / db_create.php
blobc2c25dc00cd1637e3b2807dbddd0fd74c5611dc9
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 /**
7 * Gets some core libraries
8 */
9 require_once('./libraries/grab_globals.lib.php');
10 $js_to_run = 'functions.js';
11 require_once('./header.inc.php');
12 require_once('./libraries/common.lib.php');
13 require_once('./libraries/mysql_charsets.lib.php');
16 PMA_checkParameters(array('db'));
18 /**
19 * Defines the url to return to in case of error in a sql statement
21 $err_url = 'main.php?' . PMA_generate_common_url();
23 /**
24 * Builds and executes the db creation sql query
26 $sql_query = 'CREATE DATABASE ' . PMA_backquote($db);
27 if (!empty($db_collation) && PMA_MYSQL_INT_VERSION >= 40101) {
28 list($db_charset) = explode('_', $db_collation);
29 if (in_array($db_charset, $mysql_charsets) && in_array($db_collation, $mysql_collations[$db_charset])) {
30 $sql_query .= ' DEFAULT' . PMA_generateCharsetQueryPart($db_collation);
32 unset($db_charset, $db_collation);
34 $sql_query .= ';';
36 $result = PMA_DBI_query($sql_query);
39 /**
40 * Displays the result and calls default page
42 $message = $strDatabase . ' ' . htmlspecialchars($db) . ' ' . $strHasBeenCreated;
43 require_once('./' . $cfg['DefaultTabDatabase']);