update
[phpmyadmin/crack.git] / db_details.php3
blob62343245f13b486d3067dff3f2a55f48e3c7168c
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 if (get_magic_quotes_gpc()) {
23 $query_to_display = stripslashes($sql_query);
25 else {
26 $query_to_display = $sql_query;
28 } else {
29 $query_to_display = '';
33 /**
34 * Gets informations about the database and, if it is empty, move to the
35 * "db_details_structure.php3" script where table can be created
37 $sub_part = '';
38 require('./db_details_db_info.php3');
39 if ($num_tables == 0 && empty($db_query_force)) {
40 $is_info = TRUE;
41 include('./db_details_structure.php3');
42 exit();
45 // loic1: defines wether file upload is available or not
46 $is_upload = (PMA_PHP_INT_VERSION >= 40000 && function_exists('ini_get'))
47 ? ((strtolower(ini_get('file_uploads')) == 'on' || ini_get('file_uploads') == 1) && intval(ini_get('upload_max_filesize')))
48 // loic1: php 3.0.15 and lower bug -> always enabled
49 : (PMA_PHP_INT_VERSION < 30016 || intval(@get_cfg_var('upload_max_filesize')));
51 $auto_sel = ($cfg['TextareaAutoSelect'])
52 ? "\n" . ' onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; this.form.elements[\'sql_query\'].select();}"'
53 : '';
55 <!-- Query box, sql file loader and bookmark support -->
56 <a name="querybox"></a>
57 <form method="post" action="read_dump.php3"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; echo "\n"; ?>
58 onsubmit="return checkSqlQuery(this)">
59 <input type="hidden" name="is_js_confirmed" value="0" />
60 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
61 <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
62 <input type="hidden" name="server" value="<?php echo $server; ?>" />
63 <input type="hidden" name="db" value="<?php echo $db; ?>" />
64 <input type="hidden" name="pos" value="0" />
65 <input type="hidden" name="goto" value="db_details.php3" />
66 <input type="hidden" name="zero_rows" value="<?php echo htmlspecialchars($strSuccess); ?>" />
67 <input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
68 <?php echo sprintf($strRunSQLQuery, $db) . ' ' . PMA_showMySQLDocu('Reference', 'SELECT'); ?>&nbsp;:<br />
69 <div style="margin-bottom: 5px">
70 <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; ?>>
71 <?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : ''); ?>
72 </textarea><br />
73 <input type="checkbox" name="show_query" value="1" id="checkbox_show_query" checked="checked" />&nbsp;
74 <label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label><br />
75 </div>
76 <?php
77 // loic1: displays import dump feature only if file upload available
78 if ($is_upload) {
79 echo ' <i>' . $strOr . '</i> ' . $strLocationTextfile . '&nbsp;:<br />' . "\n";
81 <div style="margin-bottom: 5px">
82 <input type="file" name="sql_file" class="textfield" /><br />
83 <?php
84 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
85 $temp_charset = reset($cfg['AvailableCharsets']);
86 echo $strCharsetOfFile . "\n"
87 . ' <select name="charset_of_file" size="1">' . "\n"
88 . ' <option value="' . $temp_charset . '"';
89 if ($temp_charset == $charset) {
90 echo ' selected="selected"';
92 echo '>' . $temp_charset . '</option>' . "\n";
93 while ($temp_charset = next($cfg['AvailableCharsets'])) {
94 echo ' <option value="' . $temp_charset . '"';
95 if ($temp_charset == $charset) {
96 echo ' selected="selected"';
98 echo '>' . $temp_charset . '</option>' . "\n";
100 echo ' </select>';
101 } // end if (recoding)
102 echo "\n";
104 </div>
105 <?php
106 } // end if (is upload)
107 echo "\n";
109 // web-server upload directory
110 // (TODO: display the charset selection, even if is_upload == FALSE)
112 if ($cfg['UploadDir'] != '') {
113 if ($handle = @opendir($cfg['UploadDir'])) {
114 $is_first = 0;
115 while ($file = @readdir($handle)) {
116 if (is_file($cfg['UploadDir'] . $file) && substr($file, -4) == '.sql') {
117 if ($is_first == 0) {
118 echo "\n";
119 echo ' <i>' . $strOr . '</i> ' . $strWebServerUploadDirectory . '&nbsp;:<br />' . "\n";
120 echo ' <div style="margin-bottom: 5px">' . "\n";
121 echo ' <select size="1" name="sql_localfile">' . "\n";
122 echo ' <option value="" selected="selected"></option>' . "\n";
123 } // end if (is_first)
124 echo ' <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
125 $is_first++;
126 } // end if (is_file)
127 } // end while
128 if ($is_first > 0) {
129 echo ' </select>' . "\n"
130 . ' </div>' . "\n\n";
131 } // end if (isfirst > 0)
132 @closedir($handle);
134 else {
135 echo ' <div style="margin-bottom: 5px">' . "\n";
136 echo ' <font color="red">' . $strError . '</font><br />' . "\n";
137 echo ' ' . $strWebServerUploadDirectoryError . "\n";
138 echo ' </div>' . "\n";
140 } // end if (web-server upload directory)
142 // Bookmark Support
143 if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
144 if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
145 echo " <i>$strOr</i> $strBookmarkQuery&nbsp;:<br />\n";
146 echo ' <div style="margin-bottom: 5px">' . "\n";
147 echo ' <select name="id_bookmark">' . "\n";
148 echo ' <option value=""></option>' . "\n";
149 while (list($key, $value) = each($bookmark_list)) {
150 echo ' <option value="' . $value . '">' . htmlentities($key) . '</option>' . "\n";
152 echo ' </select>' . "\n";
153 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";
154 echo ' &nbsp;<input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
155 echo ' &nbsp;<input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
156 echo ' <br />' . "\n";
157 echo ' </div>' . "\n";
161 // Encoding setting form appended by Y.Kawada
162 if (function_exists('PMA_set_enc_form')) {
163 echo PMA_set_enc_form(' ');
166 <input type="submit" name="SQL" value="<?php echo $strGo; ?>" />
167 </form>
170 <?php
172 * Displays the footer
174 echo "\n";
175 require('./footer.inc.php3');