lang
[phpmyadmin/crack.git] / db_details.php3
blobc5aa5e36a0414445f76c28bce280b9a6253ac8cd
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, $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 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
79 $temp_charset = reset($cfg['AvailableCharsets']);
80 echo $strCharsetOfFile . "\n"
81 . ' <select name="charset_of_file" size="1">' . "\n"
82 . ' <option value="' . $temp_charset . '"';
83 if ($temp_charset == $charset) {
84 echo ' selected="selected"';
86 echo '>' . $temp_charset . '</option>' . "\n";
87 while ($temp_charset = next($cfg['AvailableCharsets'])) {
88 echo ' <option value="' . $temp_charset . '"';
89 if ($temp_charset == $charset) {
90 echo ' selected="selected"';
92 echo '>' . $temp_charset . '</option>' . "\n";
94 echo ' </select><br />' . "\n" . ' ';
95 } // end if (recoding)
96 $is_gzip = ($cfg['GZipDump'] && @function_exists('gzopen'));
97 $is_bzip = ($cfg['BZipDump'] && @function_exists('bzdecompress'));
98 if ($is_bzip || $is_gzip) {
99 echo ' ' . $strCompression . ':' . "\n"
100 . ' <input type="radio" id="radio_sql_file_compression_auto" name="sql_file_compression" value="" checked="checked" />' . "\n"
101 . ' <label for="radio_sql_file_compression_auto">' . $strAutodetect . '</label>&nbsp;&nbsp;&nbsp;' . "\n"
102 . ' <input type="radio" id="radio_sql_file_compression_plain" name="sql_file_compression" value="text/plain" />' . "\n"
103 . ' <label for="radio_sql_file_compression_plain">' . $strNone . '</label>&nbsp;&nbsp;&nbsp;' . "\n";
104 if ($is_gzip) {
105 echo ' <input type="radio" id="radio_sql_file_compression_gzip" name="sql_file_compression" value="application/x-gzip" />' . "\n"
106 . ' <label for="radio_sql_file_compression_gzip">' . $strGzip . '</label>&nbsp;&nbsp;&nbsp;' . "\n";
108 if ($is_bzip) {
109 echo ' <input type="radio" id="radio_sql_file_compression_bzip" name="sql_file_compression" value="application/x-bzip" />' . "\n"
110 . ' <label for="radio_sql_file_compression_bzip">' . $strBzip . '</label>&nbsp;&nbsp;&nbsp;' . "\n";
112 } else {
113 echo ' <input type="hidden" name="sql_file_compression" value="text/plain" />' . "\n";
116 </div>
117 <?php
118 } // end if (is upload)
119 echo "\n";
121 // web-server upload directory
122 // (TODO: display the charset selection, even if is_upload == FALSE)
124 if ($cfg['UploadDir'] != '') {
125 if ($handle = @opendir($cfg['UploadDir'])) {
126 $is_first = 0;
127 while ($file = @readdir($handle)) {
128 if (is_file($cfg['UploadDir'] . $file) && substr($file, -4) == '.sql') {
129 if ($is_first == 0) {
130 echo "\n";
131 echo ' <i>' . $strOr . '</i> ' . $strWebServerUploadDirectory . '&nbsp;:<br />' . "\n";
132 echo ' <div style="margin-bottom: 5px">' . "\n";
133 echo ' <select size="1" name="sql_localfile">' . "\n";
134 echo ' <option value="" selected="selected"></option>' . "\n";
135 } // end if (is_first)
136 echo ' <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
137 $is_first++;
138 } // end if (is_file)
139 } // end while
140 if ($is_first > 0) {
141 echo ' </select>' . "\n"
142 . ' </div>' . "\n\n";
143 } // end if (isfirst > 0)
144 @closedir($handle);
146 else {
147 echo ' <div style="margin-bottom: 5px">' . "\n";
148 echo ' <font color="red">' . $strError . '</font><br />' . "\n";
149 echo ' ' . $strWebServerUploadDirectoryError . "\n";
150 echo ' </div>' . "\n";
152 } // end if (web-server upload directory)
154 // Bookmark Support
155 if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
156 if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
157 echo " <i>$strOr</i> $strBookmarkQuery&nbsp;:<br />\n";
158 echo ' <div style="margin-bottom: 5px">' . "\n";
159 echo ' <select name="id_bookmark">' . "\n";
160 echo ' <option value=""></option>' . "\n";
161 while (list($key, $value) = each($bookmark_list)) {
162 echo ' <option value="' . htmlspecialchars($value) . '">' . htmlspecialchars($key) . '</option>' . "\n";
164 echo ' </select>' . "<br />\n";
165 echo ' ' . $strVar . ' (<a href="./Documentation.html#faqbookmark" target="documentation">' . $strDocu . '</a>): <input type="text" name="bookmark_variable" class="textfield" size="10" />' . "\n";
166 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";
167 echo ' &nbsp;<input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
168 echo ' &nbsp;<input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
169 echo ' <br />' . "\n";
170 echo ' </div>' . "\n";
174 // Encoding setting form appended by Y.Kawada
175 if (function_exists('PMA_set_enc_form')) {
176 echo PMA_set_enc_form(' ');
179 <input type="submit" name="SQL" value="<?php echo $strGo; ?>" />
180 </form>
183 <?php
185 * Displays the footer
187 echo "\n";
188 require('./footer.inc.php3');