xhtml typo
[phpmyadmin/crack.git] / tbl_change.php3
blob2d1d8c9d7c44eb628c45804bd290032f7c49eead
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 /**
7 * Get the variables sent or posted to this script and displays the header
8 */
9 require('./libraries/grab_globals.lib.php3');
10 $js_to_run = 'tbl_change.js';
11 require('./header.inc.php3');
12 require('./libraries/relation.lib.php3'); // foreign keys
15 /**
16 * Displays the query submitted and its result
18 if (!empty($message)) {
19 if (isset($goto)) {
20 $goto_cpy = $goto;
21 $goto = 'tbl_properties.php3?'
22 . PMA_generate_common_url($db, $table)
23 . '&amp;$show_query=1'
24 . '&amp;sql_query=' . urlencode($disp_query);
25 } else {
26 $show_query = '1';
28 if (isset($sql_query)) {
29 $sql_query_cpy = $sql_query;
30 unset($sql_query);
32 if (isset($disp_query)) {
33 $sql_query = $disp_query;
35 PMA_showMessage($message);
36 if (isset($goto_cpy)) {
37 $goto = $goto_cpy;
38 unset($goto_cpy);
40 if (isset($sql_query_cpy)) {
41 $sql_query = $sql_query_cpy;
42 unset($sql_query_cpy);
47 /**
48 * Defines the url to return to in case of error in a sql statement
50 if (!isset($goto)) {
51 $goto = 'db_details.php3';
53 if (!ereg('^(db_details|tbl_properties|tbl_select)', $goto)) {
54 $err_url = $goto . "?" . PMA_generate_common_url($db) . "&amp;sql_query=" . urlencode($sql_query);
55 } else {
56 $err_url = $goto . '?'
57 . PMA_generate_common_url($db)
58 . ((ereg('^(tbl_properties|tbl_select)', $goto)) ? '&amp;table=' . urlencode($table) : '');
62 /**
63 * Ensures db and table are valid, else moves to the "parent" script
65 require('./libraries/db_table_exists.lib.php3');
68 /**
69 * Sets parameters for links and displays top menu
71 $url_query = PMA_generate_common_url($db, $table)
72 . '&amp;goto=tbl_properties.php3';
74 require('./tbl_properties_table_info.php3');
75 echo '<br />';
78 /**
79 * Get the list of the fields of the current table
81 PMA_mysql_select_db($db);
82 $table_def = PMA_mysql_query('SHOW FIELDS FROM ' . PMA_backquote($table));
83 if (isset($primary_key)) {
84 $local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key;
85 $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
86 $row = PMA_mysql_fetch_array($result);
88 // No row returned
89 if (!$row) {
90 unset($row);
91 unset($primary_key);
92 $goto_cpy = $goto;
93 $goto = 'tbl_properties.php3?'
94 . PMA_generate_common_url($db, $table)
95 . '&amp;$show_query=1'
96 . '&amp;sql_query=' . urlencode($local_query);
97 if (isset($sql_query)) {
98 $sql_query_cpy = $sql_query;
99 unset($sql_query);
101 $sql_query = $local_query;
102 PMA_showMessage($strEmptyResultSet);
103 $goto = $goto_cpy;
104 unset($goto_cpy);
105 if (isset($sql_query_cpy)) {
106 $sql_query = $sql_query_cpy;
107 unset($sql_query_cpy);
109 } // end if (no record returned)
111 else
113 $local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1';
114 $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
115 unset($row);
118 // <markus@noga.de>
119 // retrieve keys into foreign fields, if any
120 $cfgRelation = PMA_getRelationsParam();
121 $foreigners = ($cfgRelation['relwork'] ? PMA_getForeigners($db, $table) : FALSE);
125 * Displays the form
127 // loic1: autocomplete feature of IE kills the "onchange" event handler and it
128 // must be replaced by the "onpropertychange" one in this case
129 $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5)
130 ? 'onpropertychange'
131 : 'onchange';
132 // Had to put the URI because when hosted on an https server,
133 // some browsers send wrongly this form to the http server.
136 <!-- Set on key handler for moving using by Ctrl+arrows -->
137 <script type="text/javascript" language="javascript">
138 <!--
139 document.onkeydown = onKeyDownArrowsHandler;
140 // -->
141 </script>
143 <!-- Change table properties form -->
144 <form method="post" action="tbl_replace.php3" name="insertForm" <?php if ($is_upload) echo ' enctype="multipart/form-data"'; ?>>
145 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
146 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
147 <input type="hidden" name="pos" value="<?php echo isset($pos) ? $pos : 0; ?>" />
148 <input type="hidden" name="session_max_rows" value="<?php echo isset($session_max_rows) ? $session_max_rows : ''; ?>" />
149 <input type="hidden" name="disp_direction" value="<?php echo isset($disp_direction) ? $disp_direction : ''; ?>" />
150 <input type="hidden" name="repeat_cells" value="<?php echo isset($repeat_cells) ? $repeat_cells : ''; ?>" />
151 <input type="hidden" name="dontlimitchars" value="<?php echo (isset($dontlimitchars) ? $dontlimitchars : 0); ?>" />
152 <input type="hidden" name="err_url" value="<?php echo urlencode($err_url); ?>" />
153 <input type="hidden" name="sql_query" value="<?php echo isset($sql_query) ? urlencode($sql_query) : ''; ?>" />
154 <?php
155 if (isset($primary_key)) {
157 <input type="hidden" name="primary_key" value="<?php echo urlencode($primary_key); ?>" />
158 <?php
160 echo "\n";
163 <table border="<?php echo $cfg['Border']; ?>">
164 <tr>
165 <th><?php echo $strField; ?></th>
166 <th><?php echo $strType; ?></th>
167 <?php
168 if ($cfg['ShowFunctionFields']) {
169 echo ' <th>' . $strFunction . '</th>' . "\n";
172 <th><?php echo $strNull; ?></th>
173 <th><?php echo $strValue; ?></th>
174 </tr>
176 <?php
177 // Set if we passed the first timestamp field
178 $timestamp_seen = 0;
179 $fields_cnt = mysql_num_rows($table_def);
181 // Set a flag here because the 'if' would not be valid in the loop
182 // if we set a value in some field
183 $insert_mode = (!isset($row) ? TRUE : FALSE);
185 for ($i = 0; $i < $fields_cnt; $i++) {
186 // Display the submit button after every 15 lines --swix
187 // (wanted to use an <a href="#bottom"> and <a name> instead,
188 // but it didn't worked because of the <base href>)
190 if ((($i % 15) == 0) && ($i != 0)) {
192 <tr>
193 <th colspan="5" align="right">
194 <input type="submit" value="<?php echo $strGo; ?>" />&nbsp;
195 </th>
196 </tr>
197 <?php
198 } // end if
199 echo "\n";
201 $row_table_def = PMA_mysql_fetch_array($table_def);
202 $field = $row_table_def['Field'];
204 // garvin: possible workaround. If current field is numerical, do not try to
205 // access the result-array with its 'associative' key but with its numerical
206 // represantation.
207 if ((PMA_PHP_INT_VERSION > 40000 && is_numeric($field)) || eregi('^[0-9]*$', $field)) {
208 $rowfield = $i;
209 } else {
210 $rowfield = $field;
213 // loic1: current date should not be set as default if the field is NULL
214 // for the current row
215 // lem9: but do not put here the current datetime if there is a default
216 // value (the real default value will be set in the
217 // Default value logic below)
218 if ($row_table_def['Type'] == 'datetime'
219 && (!isset($row_table_def['Default']))) {
220 // INSERT case
221 if ($insert_mode) {
222 $row[$rowfield] = date('Y-m-d H:i:s', time());
224 // UPDATE case with an empty and not NULL value under PHP4
225 else if (empty($row[$rowfield]) && function_exists('is_null')) {
226 $row[$rowfield] = (is_null($row[$rowfield]) ? $row[$rowfield] : date('Y-m-d H:i:s', time()));
228 // UPDATE case with an empty value under PHP3
229 else if (empty($row[$rowfield])) {
230 $row[$rowfield] = date('Y-m-d H:i:s', time());
231 } // end if... else if... else if...
233 $len = (eregi('float|double', $row_table_def['Type']))
234 ? 100
235 : @mysql_field_len($result, $i);
236 $first_timestamp = 0;
238 $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
240 <tr>
241 <td align="center" bgcolor="<?php echo $bgcolor; ?>"><?php echo htmlspecialchars($field); ?></td>
242 <?php
243 echo "\n";
245 // The type column
246 $is_binary = eregi(' binary', $row_table_def['Type']);
247 $is_blob = eregi('blob', $row_table_def['Type']);
248 $is_char = eregi('char', $row_table_def['Type']);
249 $row_table_def['True_Type'] = ereg_replace('\\(.*', '', $row_table_def['Type']);
250 switch ($row_table_def['True_Type']) {
251 case 'set':
252 $type = 'set';
253 $type_nowrap = '';
254 break;
255 case 'enum':
256 $type = 'enum';
257 $type_nowrap = '';
258 break;
259 case 'timestamp':
260 if (!$timestamp_seen) { // can only occur once per table
261 $timestamp_seen = 1;
262 $first_timestamp = 1;
264 $type = $row_table_def['Type'];
265 $type_nowrap = ' nowrap="nowrap"';
266 break;
268 default:
269 $type = $row_table_def['Type'];
270 $type_nowrap = ' nowrap="nowrap"';
271 break;
274 <td align="center" bgcolor="<?php echo $bgcolor; ?>"<?php echo $type_nowrap; ?>>
275 <?php echo $type; ?>
276 </td>
277 <?php
278 echo "\n";
280 // Prepares the field value
281 if (isset($row)) {
282 // loic1: null field value
283 if (!isset($row[$rowfield])) {
284 $row[$rowfield] = 'NULL';
285 $special_chars = '';
286 $data = $row[$rowfield];
287 } else {
288 // loic1: special binary "characters"
289 if ($is_binary || $is_blob) {
290 $row[$rowfield] = str_replace("\x00", '\0', $row[$rowfield]);
291 $row[$rowfield] = str_replace("\x08", '\b', $row[$rowfield]);
292 $row[$rowfield] = str_replace("\x0a", '\n', $row[$rowfield]);
293 $row[$rowfield] = str_replace("\x0d", '\r', $row[$rowfield]);
294 $row[$rowfield] = str_replace("\x1a", '\Z', $row[$rowfield]);
295 } // end if
296 $special_chars = htmlspecialchars($row[$rowfield]);
297 $data = $row[$rowfield];
298 } // end if... else...
299 // loic1: if a timestamp field value is not included in an update
300 // statement MySQL auto-update it to the current timestamp
301 $backup_field = ($row_table_def['True_Type'] == 'timestamp')
302 ? ''
303 : '<input type="hidden" name="fields_prev[' . urlencode($field) . ']" value="' . urlencode($row[$rowfield]) . '" />';
304 } else {
305 // loic1: display default values
306 if (!isset($row_table_def['Default'])) {
307 $row_table_def['Default'] = '';
308 $data = 'NULL';
309 } else {
310 $data = $row_table_def['Default'];
312 $special_chars = htmlspecialchars($row_table_def['Default']);
313 $backup_field = '';
316 // The function column
317 // -------------------
318 // Change by Bernard M. Piller <bernard@bmpsystems.com>
319 // We don't want binary data to be destroyed
320 // Note: from the MySQL manual: "BINARY doesn't affect how the column is
321 // stored or retrieved" so it does not mean that the contents is
322 // binary
323 if ($cfg['ShowFunctionFields']) {
324 if (($cfg['ProtectBinary'] && $is_blob)
325 || ($cfg['ProtectBinary'] == 'all' && $is_binary)) {
326 echo ' <td align="center" bgcolor="'. $bgcolor . '">' . $strBinary . '</td>' . "\n";
327 } else if (strstr($row_table_def['True_Type'], 'enum') || strstr($row_table_def['True_Type'], 'set')) {
328 echo ' <td align="center" bgcolor="'. $bgcolor . '">--</td>' . "\n";
329 } else {
331 <td bgcolor="<?php echo $bgcolor; ?>">
332 <select name="funcs[<?php echo urlencode($field); ?>]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($fields_cnt + $i + 1); ?>" id="field_<?php echo $i; ?>_1">
333 <option></option>
334 <?php
335 echo "\n";
336 $selected = '';
338 // garvin: Find the current type in the RestrictColumnTypes. Will result in 'FUNC_CHAR'
339 // or something similar. Then directly look up the entry in the RestrictFunctions array,
340 // which will then reveal the available dropdown options
341 if (isset($cfg['RestrictFunctions']) && isset($cfg['RestrictColumnTypes']) && isset($cfg['RestrictColumnTypes'][strtoupper($row_table_def['True_Type'])]) && isset($cfg['RestrictFunctions'][$cfg['RestrictColumnTypes'][strtoupper($row_table_def['True_Type'])]])) {
342 $dropdown = $cfg['RestrictFunctions'][$cfg['RestrictColumnTypes'][strtoupper($row_table_def['True_Type'])]];
343 } else {
344 $dropdown = array();
347 $dropdown_built = array();
348 $op_spacing_needed = FALSE;
350 // garvin: loop on the dropdown array and print all available options for that field.
351 for ($j = 0; $j < count($dropdown); $j++) {
352 // for default function = NOW() on first timestamp field
353 // -- swix/18jul01
354 $selected = ($first_timestamp && $dropdown[$j] == 'NOW')
355 ? ' selected="selected"'
356 : '';
357 echo ' ';
358 echo '<option' . $selected . '>' . $dropdown[$j] . '</option>' . "\n";
359 $dropdown_built[$dropdown[$j]] = 'TRUE';
360 $op_spacing_needed = TRUE;
363 // garvin: For compatibility's sake, do not let out all other functions. Instead
364 // print a seperator (blank) and then show ALL functions which weren't shown
365 // yet.
366 for ($j = 0; $j < count($cfg['Functions']); $j++) {
367 if (!isset($dropdown_built[$cfg['Functions'][$j]]) || $dropdown_built[$cfg['Functions'][$j]] != 'TRUE') {
368 // for default function = NOW() on first timestamp field
369 // -- swix/18jul01
370 $selected = ($first_timestamp && $cfg['Functions'][$j] == 'NOW')
371 ? ' selected="selected"'
372 : '';
373 if ($op_spacing_needed == TRUE) {
374 echo ' ';
375 echo '<option value="">--------</option>' . "\n";
376 $op_spacing_needed = FALSE;
379 echo ' ';
380 echo '<option' . $selected . '>' . $cfg['Functions'][$j] . '</option>' . "\n";
382 } // end for
383 unset($selected);
385 </select>
386 </td>
387 <?php
389 } // end if ($cfg['ShowFunctionFields'])
390 echo "\n";
392 // The null column
393 // ---------------
394 echo ' <td bgcolor="' . $bgcolor . '">' . "\n";
395 if (!(($cfg['ProtectBinary'] && $is_blob) || ($cfg['ProtectBinary'] == 'all' && $is_binary))
396 && $row_table_def['Null'] == 'YES') {
397 echo ' <input type="checkbox" tabindex="' . ((2 * $fields_cnt) + $i + 1) . '"'
398 . ' name="fields_null[' . urlencode($field) . ']"';
399 if ($data == 'NULL' && !$first_timestamp) {
400 echo ' checked="checked"';
402 echo ' id="field_' . $i . '_2"';
403 $onclick = ' onclick="if (this.checked) {nullify(';
404 if (strstr($row_table_def['True_Type'], 'enum')) {
405 if (strlen($row_table_def['Type']) > 20) {
406 $onclick .= '1, ';
407 } else {
408 $onclick .= '2, ';
410 } else if (strstr($row_table_def['True_Type'], 'set')) {
411 $onclick .= '3, ';
412 } else if ($foreigners && isset($foreigners[$field])) {
413 $onclick .= '4, ';
414 } else {
415 $onclick .= '5, ';
417 $onclick .= '\'' . urlencode($field) . '\', \'' . md5($field) . '\'); this.checked = true}; return true" />' . "\n";
418 echo $onclick;
419 } else {
420 echo ' &nbsp;' . "\n";
422 echo ' </td>' . "\n";
424 // The value column (depends on type)
425 // ----------------
427 include('./libraries/get_foreign.lib.php3');
429 if (isset($disp) && $disp) {
431 <td bgcolor="<?php echo $bgcolor; ?>">
432 <?php echo $backup_field . "\n"; ?>
433 <input type="hidden" name="fields_type[<?php echo urlencode($field); ?>]" value="foreign" />
434 <input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="" id="field_<?php echo $i; ?>_1" />
435 <select name="field_<?php echo md5($field); ?>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" id="field_<?php echo $i; ?>_3">
436 <option value=""></option>
437 <?php
438 echo "\n";
439 while ($relrow = @PMA_mysql_fetch_array($disp)) {
440 $key = $relrow[$foreign_field];
441 $value = (($foreign_display != FALSE) ? '&nbsp;-&nbsp;' . htmlspecialchars($relrow[$foreign_display]) : '');
442 echo ' <option value="' . htmlspecialchars($key) . '"';
443 if ($key == $data) {
444 echo ' selected="selected"';
445 } // end if
446 echo '>' . htmlspecialchars($key) . $value . '</option>' . "\n";
447 } // end while
448 echo ' </select>' . "\n";
449 echo ' </td>' . "\n";
450 unset($disp);
452 else if (strstr($row_table_def['True_Type'], 'text')) {
454 <td bgcolor="<?php echo $bgcolor; ?>">
455 <?php echo $backup_field . "\n"; ?>
456 <textarea name="fields[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>" id="field_<?php echo $i; ?>_3"
457 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>"><?php echo $special_chars; ?></textarea>
458 </td>
459 <?php
460 echo "\n";
461 if (strlen($special_chars) > 32000) {
462 echo ' <td bgcolor="' . $bgcolor . '">' . $strTextAreaLength . '</td>' . "\n";
465 else if (strstr($row_table_def['True_Type'], 'enum')) {
466 $enum = str_replace('enum(', '', $row_table_def['Type']);
467 $enum = ereg_replace('\\)$', '', $enum);
468 $enum = explode('\',\'', substr($enum, 1, -1));
469 $enum_cnt = count($enum);
471 <td bgcolor="<?php echo $bgcolor; ?>">
472 <input type="hidden" name="fields_type[<?php echo urlencode($field); ?>]" value="enum" />
473 <input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="" />
474 <?php
475 echo "\n" . ' ' . $backup_field;
477 // show dropdown or radio depend on length
478 if (strlen($row_table_def['Type']) > 20) {
479 echo "\n";
481 <select name="field_<?php echo md5($field); ?>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" id="field_<?php echo $i; ?>_3">
482 <option value=""></option>
483 <?php
484 echo "\n";
486 for ($j = 0; $j < $enum_cnt; $j++) {
487 // Removes automatic MySQL escape format
488 $enum_atom = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $enum[$j]));
489 echo ' ';
490 echo '<option value="' . urlencode($enum_atom) . '"';
491 if ($data == $enum_atom
492 || ($data == '' && (!isset($primary_key) || $row_table_def['Null'] != 'YES')
493 && isset($row_table_def['Default']) && $enum_atom == $row_table_def['Default'])) {
494 echo ' selected="selected"';
496 echo '>' . htmlspecialchars($enum_atom) . '</option>' . "\n";
497 } // end for
500 </select>
501 <?php
502 } // end if
503 else {
504 echo "\n";
505 for ($j = 0; $j < $enum_cnt; $j++) {
506 // Removes automatic MySQL escape format
507 $enum_atom = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $enum[$j]));
508 echo ' ';
509 echo '<input type="radio" name="field_' . md5($field) . '[]" value="' . urlencode($enum_atom) . '" id="field_' . $i . '_3_' . $j . '" onclick="if (typeof(document.forms[\'insertForm\'].elements[\'fields_null[' . urlencode($field) . ']\']) != \'undefined\') {document.forms[\'insertForm\'].elements[\'fields_null[' . urlencode($field) .']\'].checked = false}"';
510 if ($data == $enum_atom
511 || ($data == '' && (!isset($primary_key) || $row_table_def['Null'] != 'YES')
512 && isset($row_table_def['Default']) && $enum_atom == $row_table_def['Default'])) {
513 echo ' checked="checked"';
515 echo 'tabindex="' . ($i + 1) . '" />' . "\n";
516 echo ' <label for="field_' . $i . '_3_' . $j . '">' . htmlspecialchars($enum_atom) . '</label>' . "\n";
517 } // end for
519 } // end else
520 echo "\n";
522 </td>
523 <?php
524 echo "\n";
526 else if (strstr($row_table_def['Type'], 'set')) {
527 $set = str_replace('set(', '', $row_table_def['Type']);
528 $set = ereg_replace('\)$', '', $set);
529 $set = explode(',', $set);
531 if (isset($vset)) {
532 unset($vset);
534 for ($vals = explode(',', $data); list($t, $k) = each($vals);) {
535 $vset[$k] = 1;
537 $size = min(4, count($set));
539 <td bgcolor="<?php echo $bgcolor; ?>">
540 <?php echo $backup_field . "\n"; ?>
541 <input type="hidden" name="fields_type[<?php echo urlencode($field); ?>]" value="set" />
542 <input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="" />
543 <select name="field_<?php echo md5($field); ?>[]" size="<?php echo $size; ?>" multiple="multiple" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" id="field_<?php echo $i; ?>_3">
544 <?php
545 echo "\n";
546 $countset = count($set);
547 for ($j = 0; $j < $countset;$j++) {
548 $subset = substr($set[$j], 1, -1);
549 // Removes automatic MySQL escape format
550 $subset = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $subset));
551 echo ' ';
552 echo '<option value="'. urlencode($subset) . '"';
553 if (isset($vset[$subset]) && $vset[$subset]) {
554 echo ' selected="selected"';
556 echo '>' . htmlspecialchars($subset) . '</option>' . "\n";
557 } // end for
559 </select>
560 </td>
561 <?php
563 // Change by Bernard M. Piller <bernard@bmpsystems.com>
564 // We don't want binary data destroyed
565 else if ($is_binary || $is_blob) {
566 if (($cfg['ProtectBinary'] && $is_blob)
567 || ($cfg['ProtectBinary'] == 'all' && $is_binary)) {
568 echo "\n";
570 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
571 <?php
572 echo $strBinaryDoNotEdit;
573 if (isset($data)) {
574 $data_size = PMA_formatByteDown(strlen(stripslashes($data)), 3, 1);
575 echo ' ('. $data_size [0] . ' ' . $data_size[1] . ')';
576 unset($data_size);
578 echo "\n";
580 <input type="hidden" name="fields_type[<?php echo urlencode($field); ?>]" value="protected" />
581 <input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="" />
582 <?php
583 } else if ($is_blob) {
584 echo "\n";
586 <td bgcolor="<?php echo $bgcolor; ?>">
587 <?php echo $backup_field . "\n"; ?>
588 <textarea name="fields[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>" id="field_<?php echo $i; ?>_3"
589 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" ><?php echo $special_chars; ?></textarea>
590 <?php
592 } else {
593 if ($len < 4) {
594 $fieldsize = $maxlength = 4;
595 } else {
596 $fieldsize = (($len > 40) ? 40 : $len);
597 $maxlength = $len;
599 echo "\n";
601 <td bgcolor="<?php echo $bgcolor; ?>">
602 <?php echo $backup_field . "\n"; ?>
603 <input type="text" name="fields[<?php echo urlencode($field); ?>]" value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>" maxlength="<?php echo $maxlength; ?>" class="textfield" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" id="field_<?php echo $i; ?>_3" />
604 <?php
605 } // end if...elseif...else
607 // Upload choice (only for BLOBs because the binary
608 // attribute does not imply binary contents)
609 // (displayed whatever value the ProtectBinary has)
611 if ($is_upload && $is_blob) {
612 echo '<input type="file" name="fields_upload_' . urlencode($field) . '" class="textfield" id="field_' . $i . '_3" />';
614 echo '</td>';
616 } // end else if ( binary or blob)
617 else {
618 // For char or varchar, respect the maximum length (M); for other
619 // types (int or float), the length is not a limit on the values that
620 // can be entered, so let's be generous (20) (we could also use the
621 // real limits for each numeric type)
622 if ($is_char) {
623 $fieldsize = (($len > 40) ? 40 : $len);
624 $maxlength = $len;
626 else {
627 $fieldsize = $maxlength = 20;
628 } // end if... else...
629 echo "\n";
631 <td bgcolor="<?php echo $bgcolor; ?>">
632 <?php echo $backup_field . "\n"; ?>
633 <?php
634 if ($is_char && isset($cfg['CharEditing']) && ($cfg['CharEditing'] == 'textarea')) {
635 echo "\n";
637 <textarea name="fields[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['CharTextareaRows']; ?>" cols="<?php echo $cfg['CharTextareaCols']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>" id="field_<?php echo $i; ?>_3"
638 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" ><?php echo $special_chars; ?></textarea>
639 <?php
640 } else {
641 echo "\n";
643 <input type="text" name="fields[<?php echo urlencode($field); ?>]" value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>" maxlength="<?php echo $maxlength; ?>" class="textfield" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" id="field_<?php echo $i; ?>_3" />
644 <?php
646 echo "\n";
648 </td>
649 <?php
651 echo "\n";
653 </tr>
654 <?php
655 echo "\n";
656 } // end for
658 </table>
659 <br />
661 <table cellpadding="5">
662 <tr>
663 <td valign="middle" nowrap="nowrap">
664 <?php
665 if (isset($primary_key)) {
667 <input type="radio" name="submit_type" value="<?php echo $strSave; ?>" id="radio_submit_type_save" checked="checked" tabindex="<?php echo ((3 * $fields_cnt) + 1); ?>" /><label for="radio_submit_type_save"><?php echo $strSave; ?></label><br />
668 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $strOr; ?><br />
669 <input type="radio" name="submit_type" value="<?php echo $strInsertAsNewRow; ?>" id="radio_submit_type_insert_as_new_row" tabindex="<?php echo ((3 * $fields_cnt) + 2); ?>" /><label for="radio_submit_type_insert_as_new_row"><?php echo $strInsertAsNewRow; ?></label>
670 <?php
671 } else {
672 echo "\n";
674 <input type="hidden" name="submit_type" value="<?php echo $strInsertAsNewRow; ?>" />
675 <?php
676 echo ' ' . $strInsertAsNewRow . "\n";
678 echo "\n";
680 // Defines whether "insert a new row after the current insert" should be
681 // checked or not (keep this choice sticky)
682 $checked = (!empty($message)) ? ' checked="checked"' : '';
684 </td>
685 <td valign="middle">
686 &nbsp;&nbsp;&nbsp;<b>-- <?php echo $strAnd; ?> --</b>&nbsp;&nbsp;&nbsp;
687 </td>
688 <td valign="middle" nowrap="nowrap">
689 <input type="radio" name="after_insert" value="back" id="radio_after_insert_back" checked="checked" tabindex="<?php echo ((3 * $fields_cnt) + 3); ?>" /><label for="radio_after_insert_back"><?php echo $strAfterInsertBack; ?></label><br />
690 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $strOr; ?><br />
691 <input type="radio" name="after_insert" value="new_insert" id="radio_after_insert_new_insert"<?php echo $checked; ?> tabindex="<?php echo ((3 * $fields_cnt) + 4); ?>" /><label for="radio_after_insert_new_insert"><?php echo $strAfterInsertNewInsert; ?></label>
692 </td>
693 </tr>
695 <tr>
696 <td colspan="3" align="center" valign="middle">
697 <input type="submit" value="<?php echo $strGo; ?>" tabindex="<?php echo ((3 * $fields_cnt) + 5); ?>" />
698 </td>
699 </tr>
700 </table>
702 </form>
705 <?php
707 * Displays the footer
709 echo "\n";
710 require('./footer.inc.php3');