Drop multiple databases.
[phpmyadmin/crack.git] / tbl_change.php3
bloba4af6c49de905c9c6bff1c1acdd8625886784948
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 = (get_magic_quotes_gpc() ? stripslashes($disp_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);
45 if (get_magic_quotes_gpc()) {
46 if (!empty($sql_query)) {
47 $sql_query = stripslashes($sql_query);
49 if (!empty($primary_key)) {
50 $primary_key = stripslashes($primary_key);
52 } // end if
55 /**
56 * Defines the url to return to in case of error in a sql statement
58 if (!isset($goto)) {
59 $goto = 'db_details.php3';
61 if (!ereg('^(db_details|tbl_properties|tbl_select)', $goto)) {
62 $err_url = $goto . "?" . PMA_generate_common_url($db) . "&amp;sql_query=" . urlencode($sql_query);
63 } else {
64 $err_url = $goto . '?'
65 . PMA_generate_common_url($db)
66 . ((ereg('^(tbl_properties|tbl_select)', $goto)) ? '&amp;table=' . urlencode($table) : '');
70 /**
71 * Ensures db and table are valid, else moves to the "parent" script
73 require('./libraries/db_table_exists.lib.php3');
76 /**
77 * Sets parameters for links and displays top menu
79 $url_query = PMA_generate_common_url($db, $table)
80 . '&amp;goto=tbl_properties.php3';
82 require('./tbl_properties_table_info.php3');
83 echo '<br />';
86 /**
87 * Get the list of the fields of the current table
89 PMA_mysql_select_db($db);
90 $table_def = PMA_mysql_query('SHOW FIELDS FROM ' . PMA_backquote($table));
91 if (isset($primary_key)) {
92 $local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key;
93 $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
94 $row = PMA_mysql_fetch_array($result);
95 // No row returned
96 if (!$row) {
97 unset($row);
98 unset($primary_key);
99 $goto_cpy = $goto;
100 $goto = 'tbl_properties.php3?'
101 . PMA_generate_common_url($db, $table)
102 . '&amp;$show_query=1'
103 . '&amp;sql_query=' . urlencode($local_query);
104 if (isset($sql_query)) {
105 $sql_query_cpy = $sql_query;
106 unset($sql_query);
108 $sql_query = $local_query;
109 PMA_showMessage($strEmptyResultSet);
110 $goto = $goto_cpy;
111 unset($goto_cpy);
112 if (isset($sql_query_cpy)) {
113 $sql_query = $sql_query_cpy;
114 unset($sql_query_cpy);
116 } // end if (no record returned)
118 else
120 $local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1';
121 $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
122 unset($row);
125 // <markus@noga.de>
126 // retrieve keys into foreign fields, if any
127 $cfgRelation = PMA_getRelationsParam();
128 $foreigners = ($cfgRelation['relwork'] ? PMA_getForeigners($db, $table) : FALSE);
132 * Displays the form
134 // loic1: autocomplete feature of IE kills the "onchange" event handler and it
135 // must be replaced by the "onpropertychange" one in this case
136 $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5)
137 ? 'onpropertychange'
138 : 'onchange';
139 // Had to put the URI because when hosted on an https server,
140 // some browsers send wrongly this form to the http server.
143 <!-- Set on key handler for moving using by Ctrl+arrows -->
144 <script type="text/javascript" language="javascript">
145 <!--
146 document.onkeydown = onKeyDownArrowsHandler;
147 // -->
148 </script>
150 <!-- Change table properties form -->
151 <form method="post" action="tbl_replace.php3" name="insertForm" enctype="multipart/form-data">
152 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
153 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
154 <input type="hidden" name="pos" value="<?php echo isset($pos) ? $pos : 0; ?>" />
155 <input type="hidden" name="session_max_rows" value="<?php echo isset($session_max_rows) ? $session_max_rows : ''; ?>" />
156 <input type="hidden" name="disp_direction" value="<?php echo isset($disp_direction) ? $disp_direction : ''; ?>" />
157 <input type="hidden" name="repeat_cells" value="<?php echo isset($repeat_cells) ? $repeat_cells : ''; ?>" />
158 <input type="hidden" name="dontlimitchars" value="<?php echo (isset($dontlimitchars) ? $dontlimitchars : 0); ?>" />
159 <input type="hidden" name="err_url" value="<?php echo urlencode($err_url); ?>" />
160 <input type="hidden" name="sql_query" value="<?php echo isset($sql_query) ? urlencode($sql_query) : ''; ?>" />
161 <?php
162 if (isset($primary_key)) {
164 <input type="hidden" name="primary_key" value="<?php echo urlencode($primary_key); ?>" />
165 <?php
167 echo "\n";
170 <table border="<?php echo $cfg['Border']; ?>">
171 <tr>
172 <th><?php echo $strField; ?></th>
173 <th><?php echo $strType; ?></th>
174 <?php
175 if ($cfg['ShowFunctionFields']) {
176 echo ' <th>' . $strFunction . '</th>' . "\n";
179 <th><?php echo $strNull; ?></th>
180 <th><?php echo $strValue; ?></th>
181 </tr>
183 <?php
184 // Set if we passed the first timestamp field
185 $timestamp_seen = 0;
186 $fields_cnt = mysql_num_rows($table_def);
188 // Set a flag here because the 'if' would not be valid in the loop
189 // if we set a value in some field
190 $insert_mode = (!isset($row) ? TRUE : FALSE);
192 for ($i = 0; $i < $fields_cnt; $i++) {
193 // Display the submit button after every 15 lines --swix
194 // (wanted to use an <a href="#bottom"> and <a name> instead,
195 // but it didn't worked because of the <base href>)
197 if ((($i % 15) == 0) && ($i != 0)) {
199 <tr>
200 <th colspan="5" align="right">
201 <input type="submit" value="<?php echo $strGo; ?>" />&nbsp;
202 </th>
203 </tr>
204 <?php
205 } // end if
206 echo "\n";
208 $row_table_def = PMA_mysql_fetch_array($table_def);
209 $field = $row_table_def['Field'];
210 // loic1: current date should not be set as default if the field is NULL
211 // for the current row
212 // lem9: but do not put here the current datetime if there is a default
213 // value (the real default value will be set in the
214 // Default value logic below)
215 if ($row_table_def['Type'] == 'datetime'
216 && (!isset($row_table_def['Default']))) {
217 // INSERT case
218 if ($insert_mode) {
219 $row[$field] = date('Y-m-d H:i:s', time());
221 // UPDATE case with an empty and not NULL value under PHP4
222 else if (empty($row[$field]) && function_exists('is_null')) {
223 $row[$field] = (is_null($row[$field]) ? $row[$field] : date('Y-m-d H:i:s', time()));
225 // UPDATE case with an empty value under PHP3
226 else if (empty($row[$field])) {
227 $row[$field] = date('Y-m-d H:i:s', time());
228 } // end if... else if... else if...
230 $len = (eregi('float|double', $row_table_def['Type']))
231 ? 100
232 : @mysql_field_len($result, $i);
233 $first_timestamp = 0;
235 $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
237 <tr>
238 <td align="center" bgcolor="<?php echo $bgcolor; ?>"><?php echo htmlspecialchars($field); ?></td>
239 <?php
240 echo "\n";
242 // The type column
243 $is_binary = eregi(' binary', $row_table_def['Type']);
244 $is_blob = eregi('blob', $row_table_def['Type']);
245 $is_char = eregi('char', $row_table_def['Type']);
246 $row_table_def['True_Type'] = ereg_replace('\\(.*', '', $row_table_def['Type']);
247 switch ($row_table_def['True_Type']) {
248 case 'set':
249 $type = 'set';
250 $type_nowrap = '';
251 break;
252 case 'enum':
253 $type = 'enum';
254 $type_nowrap = '';
255 break;
256 case 'timestamp':
257 if (!$timestamp_seen) { // can only occur once per table
258 $timestamp_seen = 1;
259 $first_timestamp = 1;
261 $type = $row_table_def['Type'];
262 $type_nowrap = ' nowrap="nowrap"';
263 break;
265 default:
266 $type = $row_table_def['Type'];
267 $type_nowrap = ' nowrap="nowrap"';
268 break;
271 <td align="center" bgcolor="<?php echo $bgcolor; ?>"<?php echo $type_nowrap; ?>><?php echo $type; ?></td>
272 <?php
273 echo "\n";
275 // Prepares the field value
276 if (isset($row)) {
277 // loic1: null field value
278 if (!isset($row[$field])) {
279 $row[$field] = 'NULL';
280 $special_chars = '';
281 $data = $row[$field];
282 } else {
283 // loic1: special binary "characters"
284 if ($is_binary || $is_blob) {
285 $row[$field] = str_replace("\x00", '\0', $row[$field]);
286 $row[$field] = str_replace("\x08", '\b', $row[$field]);
287 $row[$field] = str_replace("\x0a", '\n', $row[$field]);
288 $row[$field] = str_replace("\x0d", '\r', $row[$field]);
289 $row[$field] = str_replace("\x1a", '\Z', $row[$field]);
290 } // end if
291 $special_chars = htmlspecialchars($row[$field]);
292 $data = $row[$field];
293 } // end if... else...
294 // loic1: if a timestamp field value is not included in an update
295 // statement MySQL auto-update it to the current timestamp
296 $backup_field = ($row_table_def['True_Type'] == 'timestamp')
297 ? ''
298 : '<input type="hidden" name="fields_prev[' . urlencode($field) . ']" value="' . urlencode($row[$field]) . '" />';
299 } else {
300 // loic1: display default values
301 if (!isset($row_table_def['Default'])) {
302 $row_table_def['Default'] = '';
303 $data = 'NULL';
304 } else {
305 $data = $row_table_def['Default'];
307 $special_chars = htmlspecialchars($row_table_def['Default']);
308 $backup_field = '';
311 // The function column
312 // -------------------
313 // Change by Bernard M. Piller <bernard@bmpsystems.com>
314 // We don't want binary data to be destroyed
315 // Note: from the MySQL manual: "BINARY doesn't affect how the column is
316 // stored or retrieved" so it does not mean that the contents is
317 // binary
318 if ($cfg['ShowFunctionFields']) {
319 if (($cfg['ProtectBinary'] && $is_blob)
320 || ($cfg['ProtectBinary'] == 'all' && $is_binary)) {
321 echo ' <td align="center" bgcolor="'. $bgcolor . '">' . $strBinary . '</td>' . "\n";
322 } else if (strstr($row_table_def['True_Type'], 'enum') || strstr($row_table_def['True_Type'], 'set')) {
323 echo ' <td align="center" bgcolor="'. $bgcolor . '">--</td>' . "\n";
324 } else {
326 <td bgcolor="<?php echo $bgcolor; ?>">
327 <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">
328 <option></option>
329 <?php
330 echo "\n";
331 $selected = '';
332 for ($j = 0; $j < count($cfg['Functions']); $j++) {
333 // for default function = NOW() on first timestamp field
334 // -- swix/18jul01
335 $selected = ($first_timestamp && $cfg['Functions'][$j] == 'NOW')
336 ? ' selected="selected"'
337 : '';
338 echo ' ';
339 echo '<option' . $selected . '>' . $cfg['Functions'][$j] . '</option>' . "\n";
340 } // end for
341 unset($selected);
343 </select>
344 </td>
345 <?php
347 } // end if ($cfg['ShowFunctionFields'])
348 echo "\n";
350 // The null column
351 // ---------------
352 echo ' <td bgcolor="' . $bgcolor . '">' . "\n";
353 if (!(($cfg['ProtectBinary'] && $is_blob) || ($cfg['ProtectBinary'] == 'all' && $is_binary))
354 && $row_table_def['Null'] == 'YES') {
355 echo ' <input type="checkbox" tabindex="' . ((2 * $fields_cnt) + $i + 1) . '"'
356 . ' name="fields_null[' . urlencode($field) . ']"';
357 if ($data == 'NULL' && !$first_timestamp) {
358 echo ' checked="checked"';
360 echo ' id="field_' . $i . '_2"';
361 $onclick = ' onclick="if (this.checked) {nullify(';
362 if (strstr($row_table_def['True_Type'], 'enum')) {
363 if (strlen($row_table_def['Type']) > 20) {
364 $onclick .= '1, ';
365 } else {
366 $onclick .= '2, ';
368 } else if (strstr($row_table_def['True_Type'], 'set')) {
369 $onclick .= '3, ';
370 } else if ($foreigners && isset($foreigners[$field])) {
371 $onclick .= '4, ';
372 } else {
373 $onclick .= '5, ';
375 $onclick .= '\'' . urlencode($field) . '\', \'' . md5($field) . '\'); this.checked = true}; return true" />' . "\n";
376 echo $onclick;
377 } else {
378 echo ' &nbsp;' . "\n";
380 echo ' </td>' . "\n";
382 // The value column (depends on type)
383 // ----------------
385 include('./libraries/get_foreign.lib.php3');
387 if (isset($disp) && $disp) {
389 <td bgcolor="<?php echo $bgcolor; ?>">
390 <?php echo $backup_field . "\n"; ?>
391 <input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="$foreign$" id="field_<?php echo $i; ?>_1" />
392 <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">
393 <option value=""></option>
394 <?php
395 echo "\n";
396 while ($relrow = @PMA_mysql_fetch_array($disp)) {
397 $key = $relrow[$foreign_field];
398 $value = (($foreign_display != FALSE) ? '&nbsp;-&nbsp;' . htmlspecialchars($relrow[$foreign_display]) : '');
399 echo ' <option value="' . htmlspecialchars($key) . '"';
400 if ($key == $data) {
401 echo ' selected="selected"';
402 } // end if
403 echo '>' . htmlspecialchars($key) . $value . '</option>' . "\n";
404 } // end while
405 echo ' </select>' . "\n";
406 echo ' </td>' . "\n";
407 unset($disp);
409 else if (strstr($row_table_def['True_Type'], 'text')) {
411 <td bgcolor="<?php echo $bgcolor; ?>">
412 <?php echo $backup_field . "\n"; ?>
413 <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"
414 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>"><?php echo $special_chars; ?></textarea>
415 </td>
416 <?php
417 echo "\n";
418 if (strlen($special_chars) > 32000) {
419 echo ' <td bgcolor="' . $bgcolor . '">' . $strTextAreaLength . '</td>' . "\n";
422 else if (strstr($row_table_def['True_Type'], 'enum')) {
423 $enum = str_replace('enum(', '', $row_table_def['Type']);
424 $enum = ereg_replace('\\)$', '', $enum);
425 $enum = explode('\',\'', substr($enum, 1, -1));
426 $enum_cnt = count($enum);
428 <td bgcolor="<?php echo $bgcolor; ?>">
429 <input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="$enum$" />
430 <?php
431 echo "\n" . ' ' . $backup_field;
433 // show dropdown or radio depend on length
434 if (strlen($row_table_def['Type']) > 20) {
435 echo "\n";
437 <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">
438 <option value=""></option>
439 <?php
440 echo "\n";
442 for ($j = 0; $j < $enum_cnt; $j++) {
443 // Removes automatic MySQL escape format
444 $enum_atom = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $enum[$j]));
445 echo ' ';
446 echo '<option value="' . urlencode($enum_atom) . '"';
447 if ($data == $enum_atom
448 || ($data == '' && (!isset($primary_key) || $row_table_def['Null'] != 'YES')
449 && isset($row_table_def['Default']) && $enum_atom == $row_table_def['Default'])) {
450 echo ' selected="selected"';
452 echo '>' . htmlspecialchars($enum_atom) . '</option>' . "\n";
453 } // end for
456 </select>
457 <?php
458 } // end if
459 else {
460 echo "\n";
461 for ($j = 0; $j < $enum_cnt; $j++) {
462 // Removes automatic MySQL escape format
463 $enum_atom = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $enum[$j]));
464 echo ' ';
465 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}"';
466 if ($data == $enum_atom
467 || ($data == '' && (!isset($primary_key) || $row_table_def['Null'] != 'YES')
468 && isset($row_table_def['Default']) && $enum_atom == $row_table_def['Default'])) {
469 echo ' checked="checked"';
471 echo 'tabindex="' . ($i + 1) . '" />' . "\n";
472 echo ' <label for="field_' . $i . '_3_' . $j . '">' . htmlspecialchars($enum_atom) . '</label>' . "\n";
473 } // end for
475 } // end else
476 echo "\n";
478 </td>
479 <?php
480 echo "\n";
482 else if (strstr($row_table_def['Type'], 'set')) {
483 $set = str_replace('set(', '', $row_table_def['Type']);
484 $set = ereg_replace('\)$', '', $set);
485 $set = explode(',', $set);
487 if (isset($vset)) {
488 unset($vset);
490 for ($vals = explode(',', $data); list($t, $k) = each($vals);) {
491 $vset[$k] = 1;
493 $size = min(4, count($set));
495 <td bgcolor="<?php echo $bgcolor; ?>">
496 <?php echo $backup_field . "\n"; ?>
497 <input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="$set$" />
498 <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">
499 <?php
500 echo "\n";
501 $countset = count($set);
502 for ($j = 0; $j < $countset;$j++) {
503 $subset = substr($set[$j], 1, -1);
504 // Removes automatic MySQL escape format
505 $subset = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $subset));
506 echo ' ';
507 echo '<option value="'. urlencode($subset) . '"';
508 if (isset($vset[$subset]) && $vset[$subset]) {
509 echo ' selected="selected"';
511 echo '>' . htmlspecialchars($subset) . '</option>' . "\n";
512 } // end for
514 </select>
515 </td>
516 <?php
518 // Change by Bernard M. Piller <bernard@bmpsystems.com>
519 // We don't want binary data destroyed
520 else if ($is_binary || $is_blob) {
521 if (($cfg['ProtectBinary'] && $is_blob)
522 || ($cfg['ProtectBinary'] == 'all' && $is_binary)) {
523 echo "\n";
525 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
526 <?php
527 echo $strBinaryDoNotEdit;
528 if (isset($data)) {
529 $data_size = PMA_formatByteDown(strlen(stripslashes($data)), 3, 1);
530 echo ' ('. $data_size [0] . ' ' . $data_size[1] . ')';
531 unset($data_size);
533 echo "\n";
535 <input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="$protected$" />
536 </td>
537 <?php
538 } else if ($is_blob) {
539 echo "\n";
541 <td bgcolor="<?php echo $bgcolor; ?>">
542 <?php echo $backup_field . "\n"; ?>
543 <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"
544 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" ><?php echo $special_chars; ?></textarea>
545 </td>
546 <?php
548 } else {
549 if ($len < 4) {
550 $fieldsize = $maxlength = 4;
551 } else {
552 $fieldsize = (($len > 40) ? 40 : $len);
553 $maxlength = $len;
555 echo "\n";
557 <td bgcolor="<?php echo $bgcolor; ?>">
558 <?php echo $backup_field . "\n"; ?>
559 <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" />
560 </td>
561 <?php
562 } // end if...elseif...else
564 // Upload choice
565 // (displayed whatever value the ProtectBinary has)
567 if ($is_upload) {
568 echo '<td><input type="file" name="fields_upload_' . urlencode($field) . '" class="textfield" id="field_' . $i . '_3" />';
569 echo '<input type="checkbox" checked="checked" name="fields_upload_binary_' . urlencode($field) . '" id="field_' . $i . '_4" />';
570 echo '<label for="fields_upload_binary_' . urlencode($field) . '">' . $strBinary . '</label>';
571 echo '<a href="Documentation.html#binary_upload" target="documentation">(' . $strDocu . ')</a>';
572 echo '</td>';
575 } // end else if ( binary or blob)
576 else {
577 // For char or varchar, respect the maximum length (M); for other
578 // types (int or float), the length is not a limit on the values that
579 // can be entered, so let's be generous (20) (we could also use the
580 // real limits for each numeric type)
581 if ($is_char) {
582 $fieldsize = (($len > 40) ? 40 : $len);
583 $maxlength = $len;
585 else {
586 $fieldsize = $maxlength = 20;
587 } // end if... else...
588 echo "\n";
590 <td bgcolor="<?php echo $bgcolor; ?>">
591 <?php echo $backup_field . "\n"; ?>
592 <?php
593 if ($is_char && isset($cfg['CharEditing']) && ($cfg['CharEditing'] == 'textarea')) {
594 echo "\n";
596 <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"
597 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" ><?php echo $special_chars; ?></textarea>
598 <?php
599 } else {
600 echo "\n";
602 <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" />
603 <?php
605 echo "\n";
607 </td>
608 <?php
610 echo "\n";
612 </tr>
613 <?php
614 echo "\n";
615 } // end for
617 </table>
618 <br />
620 <table cellpadding="5">
621 <tr>
622 <td valign="middle" nowrap="nowrap">
623 <?php
624 if (isset($primary_key)) {
626 <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 />
627 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $strOr; ?><br />
628 <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>
629 <?php
630 } else {
631 echo "\n";
633 <input type="hidden" name="submit_type" value="<?php echo $strInsertAsNewRow; ?>" />
634 <?php
635 echo ' ' . $strInsertAsNewRow . "\n";
637 echo "\n";
639 // Defines whether "insert a new row after the current insert" should be
640 // checked or not (keep this choice sticky)
641 $checked = (!empty($message)) ? ' checked="checked"' : '';
643 </td>
644 <td valign="middle">
645 &nbsp;&nbsp;&nbsp;<b>-- <?php echo $strAnd; ?> --</b>&nbsp;&nbsp;&nbsp;
646 </td>
647 <td valign="middle" nowrap="nowrap">
648 <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 />
649 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $strOr; ?><br />
650 <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>
651 </td>
652 </tr>
654 <tr>
655 <td colspan="3" align="center" valign="middle">
656 <input type="submit" value="<?php echo $strGo; ?>" tabindex="<?php echo ((3 * $fields_cnt) + 5); ?>" />
657 </td>
658 </tr>
659 </table>
661 </form>
664 <?php
666 * Displays the footer
668 echo "\n";
669 require('./footer.inc.php3');