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