strDefaultValueHelp
[phpmyadmin/crack.git] / tbl_query_box.php3
bloba86ff4e3e79103764f147d975c72ae2f7d1658ff
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 /**
7 * Defines the query to be displayed in the query textarea
8 */
9 if (isset($show_query) && $show_query == '1') {
10 // This script has been called by read_dump.php3
11 if (isset($sql_query_cpy)) {
12 $query_to_display = $sql_query_cpy;
14 // Other cases
15 else if (get_magic_quotes_gpc()) {
16 $query_to_display = stripslashes($sql_query);
18 else {
19 $query_to_display = $sql_query;
21 } else {
22 $query_to_display = '';
24 unset($sql_query);
27 /**
28 * Get the list and number of fields
30 $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db);
31 $result = @PMA_mysql_query($local_query);
32 if (!$result) {
33 PMA_mysqlDie('', $local_query, '', $err_url);
35 else {
36 $fields_cnt = mysql_num_rows($result);
37 while ($row = PMA_mysql_fetch_array($result)) {
38 $fields_list[] = $row['Field'];
39 } // end while
40 mysql_free_result($result);
44 /**
45 * Work on the table
47 // loic1: defines wether file upload is available or not
48 // ($is_upload now defined in common.lib.php3)
50 $auto_sel = ($cfg['TextareaAutoSelect']
51 // 2003-02-05 rabus: This causes big trouble with Opera 7 for
52 // Windows, so let's disable it there...
53 && !(PMA_USR_OS == 'Win' && PMA_USR_BROWSER_AGENT == 'OPERA' && PMA_USR_BROWSER_VER >= 7))
54 ? "\n" . ' onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; this.form.elements[\'sql_query\'].select();}"'
55 : '';
57 <!-- Query box and bookmark support -->
58 <li>
59 <a name="querybox"></a>
60 <form method="post" action="read_dump.php3"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; echo "\n"; ?>
61 onsubmit="return checkSqlQuery(this)" name="sqlform">
62 <input type="hidden" name="is_js_confirmed" value="0" />
63 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
64 <input type="hidden" name="pos" value="0" />
65 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
66 <input type="hidden" name="zero_rows" value="<?php echo $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, htmlspecialchars($db)) . ' ' . PMA_showMySQLDocu('Reference', 'SELECT') . '&nbsp;&nbsp;&nbsp;' . $strFields . ':' . "\n"; ?>
69 <select name="dummy" size="1">
70 <?php
71 echo "\n";
72 for ($i = 0 ; $i < $fields_cnt; $i++) {
73 echo ' '
74 . '<option value="' . urlencode($fields_list[$i]) . '">' . htmlspecialchars($fields_list[$i]) . '</option>' . "\n";
77 </select>
78 <input type="button" name="insert" value="<?php echo($strInsert); ?>" onclick="sqlform.sql_query.value = sqlform.sql_query.value + sqlform.dummy.value" />
79 <br />
80 <div style="margin-bottom: 5px">
81 <textarea name="sql_query" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols'] * 2; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>"<?php echo $auto_sel; ?>>
82 <?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE 1'); ?>
83 </textarea><br />
84 <input type="checkbox" name="show_query" value="1" id="checkbox_show_query" checked="checked" />&nbsp;
85 <label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label><br />
86 </div>
87 <?php
88 // loic1: displays import dump feature only if file upload available
89 if ($is_upload) {
90 echo ' <i>' . $strOr . '</i> ' . $strLocationTextfile . '&nbsp;:<br />' . "\n";
92 <div style="margin-bottom: 5px">
93 <input type="file" name="sql_file" class="textfield" /><br />
94 <?php
95 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
96 $temp_charset = reset($cfg['AvailableCharsets']);
97 echo $strCharsetOfFile . "\n"
98 . ' <select name="charset_of_file" size="1">' . "\n"
99 . ' <option value="' . $temp_charset . '"';
100 if ($temp_charset == $charset) {
101 echo ' selected="selected"';
103 echo '>' . $temp_charset . '</option>' . "\n";
104 while ($temp_charset = next($cfg['AvailableCharsets'])) {
105 echo ' <option value="' . $temp_charset . '"';
106 if ($temp_charset == $charset) {
107 echo ' selected="selected"';
109 echo '>' . $temp_charset . '</option>' . "\n";
110 } // end while
111 echo ' </select><br />' . "\n" . ' ';
112 } // end if
113 $is_gzip = ($cfg['GZipDump'] && @function_exists('gzopen'));
114 $is_bzip = ($cfg['BZipDump'] && @function_exists('bzdecompress'));
115 if ($is_bzip || $is_gzip) {
116 echo ' ' . $strCompression . ':' . "\n"
117 . ' <input type="radio" id="radio_sql_file_compression_plain" name="sql_file_compression" value="text/plain" checked="checked" />' . "\n"
118 . ' <label for="radio_sql_file_compression_plain">' . $strNone . '</label>&nbsp;&nbsp;&nbsp;' . "\n";
119 if ($is_gzip) {
120 echo ' <input type="radio" id="radio_sql_file_compression_gzip" name="sql_file_compression" value="application/x-gzip" />' . "\n"
121 . ' <label for="radio_sql_file_compression_gzip">' . $strGzip . '</label>&nbsp;&nbsp;&nbsp;' . "\n";
123 if ($is_bzip) {
124 echo ' <input type="radio" id="radio_sql_file_compression_bzip" name="sql_file_compression" value="application/x-bzip" />' . "\n"
125 . ' <label for="radio_sql_file_compression_bzip">' . $strBzip . '</label>&nbsp;&nbsp;&nbsp;' . "\n";
127 } else {
128 echo ' <input type="hidden" name="sql_file_compression" value="text/plain" />' . "\n";
131 </div>
132 <?php
133 } // end if
134 echo "\n";
136 // Encoding setting form appended by Y.Kawada
137 if (function_exists('PMA_set_enc_form')) {
138 echo PMA_set_enc_form(' ');
141 // Bookmark Support
142 if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
143 if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
144 echo " <i>$strOr</i> $strBookmarkQuery&nbsp;:<br />\n";
145 echo ' <div style="margin-bottom: 5px">' . "\n";
146 echo ' <select name="id_bookmark" style="vertical-align: middle">' . "\n";
147 echo ' <option value=""></option>' . "\n";
148 while (list($key, $value) = each($bookmark_list)) {
149 echo ' <option value="' . $value . '">' . htmlentities($key) . '</option>' . "\n";
151 echo ' </select>' . "\n";
152 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";
153 echo ' &nbsp;<input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
154 echo ' &nbsp;<input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
155 echo ' <br />' . "\n";
156 echo ' </div>' . "\n";
160 <input type="submit" name="SQL" value="<?php echo $strGo; ?>" />
161 </form>
162 </li>
164 <?php
165 // loic1: displays import dump feature only if file upload available
166 if ($is_upload) {
168 <!-- Insert a text file -->
169 <li>
170 <div style="margin-bottom: 10px"><a href="ldi_table.php3?<?php echo $url_query; ?>"><?php echo $strInsertTextfiles; ?></a></div>
171 </li>
172 <?php
174 echo "\n";