Rev Author Line No. Line
250 kaklik 1 <?php
2 /* $Id: db_create.php,v 2.10 2005/11/24 09:12:16 nijel Exp $ */
3 // vim: expandtab sw=4 ts=4 sts=4:
4  
5  
6 /**
7 * Gets some core libraries
8 */
9 require_once('./libraries/common.lib.php');
10 $js_to_run = 'functions.js';
11 require_once('./libraries/header.inc.php');
12 require_once('./libraries/mysql_charsets.lib.php');
13  
14  
15 PMA_checkParameters(array('db'));
16  
17 /**
18 * Defines the url to return to in case of error in a sql statement
19 */
20 $err_url = 'main.php?' . PMA_generate_common_url();
21  
22 /**
23 * Builds and executes the db creation sql query
24 */
25 $sql_query = 'CREATE DATABASE ' . PMA_backquote($db);
26 if (!empty($db_collation) && PMA_MYSQL_INT_VERSION >= 40101) {
27 list($db_charset) = explode('_', $db_collation);
28 if (in_array($db_charset, $mysql_charsets) && in_array($db_collation, $mysql_collations[$db_charset])) {
29 $sql_query .= ' DEFAULT' . PMA_generateCharsetQueryPart($db_collation);
30 }
31 unset($db_charset, $db_collation);
32 }
33 $sql_query .= ';';
34  
35 $result = PMA_DBI_query($sql_query);
36  
37  
38 /**
39 * Displays the result and calls default page
40 */
41 $message = $strDatabase . ' ' . htmlspecialchars($db) . ' ' . $strHasBeenCreated;
42 require_once('./' . $cfg['DefaultTabDatabase']);
43  
44 ?>