1 | <?php
|
---|
2 | /* $Id: db_details_common.php,v 2.3 2003/12/30 18:24:10 rabus Exp $ */
|
---|
3 | // vim: expandtab sw=4 ts=4 sts=4:
|
---|
4 |
|
---|
5 | /**
|
---|
6 | * Gets some core libraries
|
---|
7 | */
|
---|
8 | require_once('./libraries/grab_globals.lib.php');
|
---|
9 | require_once('./libraries/common.lib.php');
|
---|
10 | require_once('./libraries/bookmark.lib.php');
|
---|
11 |
|
---|
12 | PMA_checkParameters(array('db'));
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Defines the urls to return to in case of error in a sql statement
|
---|
16 | */
|
---|
17 | $err_url_0 = 'main.php?' . PMA_generate_common_url();
|
---|
18 | $err_url = $cfg['DefaultTabDatabase'] . '?' . PMA_generate_common_url($db);
|
---|
19 |
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * Ensures the database exists (else move to the "parent" script) and displays
|
---|
23 | * headers
|
---|
24 | */
|
---|
25 | if (!isset($is_db) || !$is_db) {
|
---|
26 | // Not a valid db name -> back to the welcome page
|
---|
27 | if (!empty($db)) {
|
---|
28 | $is_db = @PMA_mysql_select_db($db);
|
---|
29 | }
|
---|
30 | if (empty($db) || !$is_db) {
|
---|
31 | header('Location: ' . $cfg['PmaAbsoluteUri'] . 'main.php?' . PMA_generate_common_url('', '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
|
---|
32 | exit;
|
---|
33 | }
|
---|
34 | } // end if (ensures db exists)
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * Changes database charset if requested by the user
|
---|
38 | */
|
---|
39 | if (isset($submitcharset) && PMA_MYSQL_INT_VERSION >= 40101) {
|
---|
40 | $sql_query = 'ALTER DATABASE ' . PMA_backquote($db) . ' DEFAULT CHARACTER SET ' . $db_charset;
|
---|
41 | $result = PMA_mysql_query($sql_query, $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), $sql_query, '', $err_url);
|
---|
42 | $message = $strSuccess;
|
---|
43 | }
|
---|
44 |
|
---|
45 | // Displays headers
|
---|
46 | if (!isset($message)) {
|
---|
47 | $js_to_run = 'functions.js';
|
---|
48 | require_once('./header.inc.php');
|
---|
49 | // Reloads the navigation frame via JavaScript if required
|
---|
50 | if (isset($reload) && $reload) {
|
---|
51 | echo "\n";
|
---|
52 | ?>
|
---|
53 | <script type="text/javascript" language="javascript1.2">
|
---|
54 | <!--
|
---|
55 | window.parent.frames['nav'].location.replace('./left.php?<?php echo PMA_generate_common_url($db, '', '&'); ?>&hash=' + <?php echo (($cfg['QueryFrame'] && $cfg['QueryFrameJS']) ? 'window.parent.frames[\'queryframe\'].document.hashform.hash.value' : "'" . md5($cfg['PmaAbsoluteUri']) . "'"); ?>);
|
---|
56 | //-->
|
---|
57 | </script>
|
---|
58 | <?php
|
---|
59 | }
|
---|
60 | echo "\n";
|
---|
61 | } else {
|
---|
62 | PMA_showMessage($message);
|
---|
63 | }
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * Set parameters for links
|
---|
67 | */
|
---|
68 | $url_query = PMA_generate_common_url($db);
|
---|
69 |
|
---|
70 | ?>
|
---|