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