bug 772765
[phpmyadmin/crack.git] / ldi_table.php3
blob69d374d44450fa1d262ded3634cef1e5057da424
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 /**
7 * This file defines the forms used to insert a textfile into a table
8 */
10 // Check parameters
11 if (!defined('PMA_COMMON_LIB_INCLUDED')) {
12 include('./libraries/common.lib.php3');
14 PMA_checkParameters(array('db', 'table'));
17 /**
18 * Gets some core libraries and displays links
20 require('./tbl_properties_common.php3');
21 $err_url = 'ldi_table.php3' . $err_url;
22 $url_query .= '&amp;goto=ldi_table.php3&amp;back=ldi_table.php3';
23 require('./tbl_properties_table_info.php3');
25 /**
26 * Displays the form
29 <form action="ldi_check.php3" method="post" enctype="multipart/form-data">
30 <table cellpadding="5" border="2">
31 <tr>
32 <td><?php echo $strLocationTextfile; ?></td>
33 <td colspan="2"><input type="file" name="textfile" />
34 <?php
35 if ($cfg['UploadDir'] != '') {
37 if ($handle = @opendir($cfg['UploadDir'])) {
38 $is_first = 0;
39 while ($file = @readdir($handle)) {
40 if (is_file($cfg['UploadDir'] . $file) && substr($file, -4) == '.csv') {
41 if ($is_first == 0) {
42 $is_upload_dir = true;
43 echo "<br />\n";
44 echo ' <i>' . $strOr . '</i> ' . $strWebServerUploadDirectory . '&nbsp;: ' . "\n";
45 echo ' <div style="margin-bottom: 5px">' . "\n";
46 echo ' <select size="1" name="local_textfile">' . "\n";
47 echo ' <option value="" selected="selected"></option>' . "\n";
48 } // end if (is_first)
49 echo ' <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
50 $is_first++;
51 } // end if (is_file)
52 } // end while
53 if ($is_first > 0) {
54 echo ' </select>' . "\n"
55 . ' </div>' . "\n\n";
56 } // end if (isfirst > 0)
57 @closedir($handle);
58 } else {
59 echo ' <div style="margin-bottom: 5px">' . "\n";
60 echo ' <font color="red">' . $strError . '</font><br />' . "\n";
61 echo ' ' . $strWebServerUploadDirectoryError . "\n";
62 echo ' </div>' . "\n";
64 } // end if (web-server upload directory)
65 echo "\n";
67 </td>
68 </tr>
70 <?php
71 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
72 $temp_charset = reset($cfg['AvailableCharsets']);
73 echo ' <tr>' . "\n"
74 . ' <td>' . $strCharsetOfFile . '</td>' . "\n"
75 . ' <td colspan="2">' . "\n"
76 . ' <select name="charset_of_file" size="1">' . "\n"
77 . ' <option value="' . $temp_charset . '"';
78 if ($temp_charset == $charset) {
79 echo ' selected="selected"';
81 echo '>' . $temp_charset . '</option>' . "\n";
82 while ($temp_charset = next($cfg['AvailableCharsets'])) {
83 echo ' <option value="' . $temp_charset . '"';
84 if ($temp_charset == $charset) {
85 echo ' selected="selected"';
87 echo '>' . $temp_charset . '</option>' . "\n";
88 } // end while
89 echo ' </select>' . "\n";
90 echo ' </td>' . "\n";
91 echo ' </tr>';
92 } // end if
93 echo "\n";
95 <tr>
96 <td><?php echo $strReplaceTable; ?></td>
97 <td><input type="checkbox" name="replace" value="REPLACE" id="checkbox_replace" /><?php echo $strReplace; ?></td>
98 <td><label for="checkbox_replace"><?php echo $strTheContents; ?></label></td>
99 </tr>
100 <tr>
101 <td><?php echo $strFieldsTerminatedBy; ?></td>
102 <td><input type="text" name="field_terminater" size="2" maxlength="2" value=";" /></td>
103 <td><?php echo $strTheTerminator; ?></td>
104 </tr>
105 <tr>
106 <td><?php echo $strFieldsEnclosedBy; ?></td>
107 <td>
108 <input type="text" name="enclosed" size="1" maxlength="1" value="&quot;" />
109 <input type="checkbox" name="enclose_option" value="OPTIONALLY" id="checkbox_enclose_option" />
110 <label for="checkbox_enclose_option"><?php echo $strOptionally; ?></label>
111 </td>
112 <td><?php echo $strOftenQuotation; ?></td>
113 </tr>
114 <tr>
115 <td><?php echo $strFieldsEscapedBy; ?></td>
116 <td><input type="text" name="escaped" size="2" maxlength="2" value="\" /></td>
117 <td><?php echo $strOptionalControls; ?></td>
118 </tr>
119 <tr>
120 <td><?php echo $strLinesTerminatedBy; ?></td>
121 <td><input type="text" name="line_terminator" size="8" maxlength="8" value="<?php echo ((PMA_whichCrlf() == "\n") ? '\n' : '\r\n'); ?>" /></td>
122 <td><?php echo $strCarriage; ?><br /><?php echo $strLineFeed; ?></td>
123 </tr>
124 <tr>
125 <td><?php echo $strColumnNames; ?></td>
126 <td><input type="text" name="column_name" /></td>
127 <td><?php echo $strIfYouWish; ?></td>
128 </tr>
129 <?php
130 // 2002/2/22 appended by Y.Kawada: Kanji encoding convert controls
131 if (function_exists('PMA_set_enc_form')) {
132 echo ' <tr>' . "\n"
133 . ' <td>' . $strKanjiEncodConvert . '</td>' . "\n"
134 . ' <td colspan=2>' . "\n"
135 . PMA_set_enc_form(' ')
136 . ' </td>' . "\n"
137 . ' </tr>' . "\n";
138 } // end if
141 // Check if we should check the LOCAL radio button by default
142 $local_option_selected = FALSE;
144 if (PMA_MYSQL_INT_VERSION < 32349) {
145 $local_option_selected = TRUE;
148 if (PMA_MYSQL_INT_VERSION > 40003) {
149 $tmp_query = "SHOW VARIABLES LIKE 'local\\_infile'";
150 $result = PMA_mysql_query($tmp_query);
151 if ($result != FALSE && mysql_num_rows($result) > 0) {
152 $tmp = PMA_mysql_fetch_row($result);
153 if ($tmp[1] == 'ON') {
154 $local_option_selected = TRUE;
157 mysql_free_result($result);
161 <tr>
162 <td><?php echo $strLoadMethod; ?>
163 </td>
164 <td>
165 <input type="radio" id="radio_local_option_0" name="local_option" value="0" <?php echo (!$local_option_selected ? ' checked="checked" ' : ''); ?>/><label for="radio_local_option_0">...DATA</label><br />
166 <input type="radio" id="radio_local_option_1" name="local_option" value="1" <?php echo ($local_option_selected ? ' checked="checked" ' : ''); ?>/><label for="radio_local_option_1">...DATA LOCAL</label>
167 </td>
168 <td><?php echo $strLoadExplanation; ?>
169 </td>
170 </tr>
171 <tr>
172 <td colspan="3" align="center"><?php print PMA_showMySQLDocu('Reference', 'LOAD_DATA'); ?></td>
173 </tr>
174 <tr>
175 <td colspan="3" align="center">
176 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
177 <input type="hidden" name="zero_rows" value="<?php echo $strTheContent; ?>" />
178 <input type="hidden" name="goto" value="tbl_properties.php3" />
179 <input type="hidden" name="back" value="ldi_table.php3" />
180 <input type="hidden" name="into_table" value="<?php echo htmlspecialchars($table); ?>" />
181 <input type="submit" name="btnLDI" value="<?php echo $strSubmit; ?>" />&nbsp;&nbsp;
182 <input type="reset" value="<?php echo $strReset; ?>" />
183 </td>
184 </tr>
185 </table>
186 </form>
189 <?php
191 * Displays the footer
193 require('./footer.inc.php3');