remove control M
[phpmyadmin/crack.git] / db_details.php3
blobc05b006b82326c1e0b7e40059f44f10b317c509d
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 /**
7 * Runs common work
8 */
9 require('./db_details_common.php3');
10 $url_query .= '&amp;goto=db_details.php3';
13 /**
14 * Database work
16 if (isset($show_query) && $show_query == '1') {
17 // This script has been called by read_dump.php3
18 if (isset($sql_query_cpy)) {
19 $query_to_display = $sql_query_cpy;
21 // Other cases
22 else {
23 $query_to_display = $sql_query;
25 } else {
26 $query_to_display = '';
30 /**
31 * Gets informations about the database and, if it is empty, move to the
32 * "db_details_structure.php3" script where table can be created
34 $sub_part = '';
35 require('./db_details_db_info.php3');
36 if ($num_tables == 0 && empty($db_query_force)) {
37 $is_info = TRUE;
38 include('./db_details_structure.php3');
39 exit();
42 // loic1: defines wether file upload is available or not
43 // (now defined in common.lib.php3)
45 $auto_sel = ($cfg['TextareaAutoSelect']
46 // 2003-02-05 rabus: This causes big trouble with Opera 7 for
47 // Windows, so let's disable it there...
48 && !(PMA_USR_OS == 'Win' && PMA_USR_BROWSER_AGENT == 'OPERA' && PMA_USR_BROWSER_VER >= 7))
49 ? "\n" . ' onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; this.form.elements[\'sql_query\'].select();}"'
50 : '';
52 <!-- Query box, sql file loader and bookmark support -->
53 <a name="querybox"></a>
54 <form method="post" action="read_dump.php3"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; echo "\n"; ?>
55 onsubmit="return checkSqlQuery(this)">
56 <input type="hidden" name="is_js_confirmed" value="0" />
57 <?php echo PMA_generate_common_hidden_inputs($db); ?>
58 <input type="hidden" name="pos" value="0" />
59 <input type="hidden" name="goto" value="db_details.php3" />
60 <input type="hidden" name="zero_rows" value="<?php echo htmlspecialchars($strSuccess); ?>" />
61 <input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : ''); ?>" />
62 <?php echo sprintf($strRunSQLQuery, htmlspecialchars($db)) . ' ' . PMA_showMySQLDocu('Reference', 'SELECT'); ?>&nbsp;:<br />
63 <div style="margin-bottom: 5px">
64 <textarea name="sql_query" cols="<?php echo $cfg['TextareaCols'] * 2; ?>" rows="<?php echo $cfg['TextareaRows']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>"<?php echo $auto_sel; ?>>
65 <?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : ''); ?>
66 </textarea><br />
67 <input type="checkbox" name="show_query" value="1" id="checkbox_show_query" checked="checked" />&nbsp;
68 <label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label><br />
69 </div>
70 <?php
71 // loic1: displays import dump feature only if file upload available
72 if ($is_upload) {
73 echo ' <i>' . $strOr . '</i> ' . $strLocationTextfile . '&nbsp;:<br />' . "\n";
75 <div style="margin-bottom: 5px">
76 <input type="file" name="sql_file" class="textfield" /><br />
77 <?php
78 $is_gzip = ($cfg['GZipDump'] && @function_exists('gzopen'));
79 $is_bzip = ($cfg['BZipDump'] && @function_exists('bzdecompress'));
80 if ($is_bzip || $is_gzip) {
81 echo ' ' . $strCompression . ':' . "\n"
82 . ' <input type="radio" id="radio_sql_file_compression_auto" name="sql_file_compression" value="" checked="checked" />' . "\n"
83 . ' <label for="radio_sql_file_compression_auto">' . $strAutodetect . '</label>&nbsp;&nbsp;&nbsp;' . "\n"
84 . ' <input type="radio" id="radio_sql_file_compression_plain" name="sql_file_compression" value="text/plain" />' . "\n"
85 . ' <label for="radio_sql_file_compression_plain">' . $strNone . '</label>&nbsp;&nbsp;&nbsp;' . "\n";
86 if ($is_gzip) {
87 echo ' <input type="radio" id="radio_sql_file_compression_gzip" name="sql_file_compression" value="application/x-gzip" />' . "\n"
88 . ' <label for="radio_sql_file_compression_gzip">' . $strGzip . '</label>&nbsp;&nbsp;&nbsp;' . "\n";
90 if ($is_bzip) {
91 echo ' <input type="radio" id="radio_sql_file_compression_bzip" name="sql_file_compression" value="application/x-bzip" />' . "\n"
92 . ' <label for="radio_sql_file_compression_bzip">' . $strBzip . '</label>&nbsp;&nbsp;&nbsp;' . "\n";
94 } else {
95 echo ' <input type="hidden" name="sql_file_compression" value="text/plain" />' . "\n";
98 </div>
99 <?php
100 } // end if (is upload)
101 echo "\n";
103 // web-server upload directory
105 $is_upload_dir = false;
106 if (!empty($cfg['UploadDir'])) {
107 if (substr($cfg['UploadDir'], -1) != '/') {
108 $cfg['UploadDir'] .= '/';
110 if ($handle = @opendir($cfg['UploadDir'])) {
111 $is_first = 0;
112 while ($file = @readdir($handle)) {
113 if (is_file($cfg['UploadDir'] . $file) && PMA_checkFileExtensions($file, '.sql')) {
114 if ($is_first == 0) {
115 $is_upload_dir = true;
116 echo "\n";
117 echo ' <i>' . $strOr . '</i> ' . $strWebServerUploadDirectory . '&nbsp;:<br />' . "\n";
118 echo ' <div style="margin-bottom: 5px">' . "\n";
119 echo ' <select size="1" name="sql_localfile">' . "\n";
120 echo ' <option value="" selected="selected"></option>' . "\n";
121 } // end if (is_first)
122 echo ' <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
123 $is_first++;
124 } // end if (is_file)
125 } // end while
126 if ($is_first > 0) {
127 echo ' </select>' . "\n"
128 . ' </div>' . "\n\n";
129 } // end if (isfirst > 0)
130 @closedir($handle);
132 else {
133 echo ' <div style="margin-bottom: 5px">' . "\n";
134 echo ' <font color="red">' . $strError . '</font><br />' . "\n";
135 echo ' ' . $strWebServerUploadDirectoryError . "\n";
136 echo ' </div>' . "\n";
138 } // end if (web-server upload directory)
140 // Charset conversion options
141 if ($is_upload || $is_upload_dir) {
142 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
143 echo ' <div style="margin-bottom: 5px">' . "\n";
144 $temp_charset = reset($cfg['AvailableCharsets']);
145 echo $strCharsetOfFile . "\n"
146 . ' <select name="charset_of_file" size="1">' . "\n"
147 . ' <option value="' . $temp_charset . '"';
148 if ($temp_charset == $charset) {
149 echo ' selected="selected"';
151 echo '>' . $temp_charset . '</option>' . "\n";
152 while ($temp_charset = next($cfg['AvailableCharsets'])) {
153 echo ' <option value="' . $temp_charset . '"';
154 if ($temp_charset == $charset) {
155 echo ' selected="selected"';
157 echo '>' . $temp_charset . '</option>' . "\n";
159 echo ' </select><br />' . "\n" . ' ';
160 echo ' </div>' . "\n";
161 } // end if (recoding)
164 // Bookmark Support
165 if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
166 if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
167 echo " <i>$strOr</i> $strBookmarkQuery&nbsp;:<br />\n";
168 echo ' <div style="margin-bottom: 5px">' . "\n";
169 echo ' <select name="id_bookmark">' . "\n";
170 echo ' <option value=""></option>' . "\n";
171 while (list($key, $value) = each($bookmark_list)) {
172 echo ' <option value="' . htmlspecialchars($value) . '">' . htmlspecialchars($key) . '</option>' . "\n";
174 echo ' </select>' . "<br />\n";
175 echo ' ' . $strVar . ' (<a href="./Documentation.html#faqbookmark" target="documentation">' . $strDocu . '</a>): <input type="text" name="bookmark_variable" class="textfield" size="10" />' . "\n";
176 echo ' <input type="radio" name="action_bookmark" value="0" id="radio_bookmark0" checked="checked" style="vertical-align: middle" /><label for="radio_bookmark0">' . $strSubmit . '</label>' . "\n";
177 echo ' &nbsp;<input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
178 echo ' &nbsp;<input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
179 echo ' <br />' . "\n";
180 echo ' </div>' . "\n";
184 // Encoding setting form appended by Y.Kawada
185 if (function_exists('PMA_set_enc_form')) {
186 echo PMA_set_enc_form(' ');
189 <input type="submit" name="SQL" value="<?php echo $strGo; ?>" />
190 </form>
193 <?php
195 * Displays the footer
197 echo "\n";
198 require('./footer.inc.php3');