bug 619097
[phpmyadmin/crack.git] / tbl_change.php3
blob84a9f0c0b17fd395dea5416299d3ebff5f0fd0fb
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 . '?lang=' . $lang
23 . '&amp;convcharset=' . $convcharset
24 . '&amp;server=' . $server
25 . '&amp;db=' . urlencode($db)
26 . '&amp;table=' . urlencode($table)
27 . '&amp;$show_query=1'
28 . '&amp;sql_query=' . urlencode($disp_query);
29 } else {
30 $show_query = '1';
32 if (isset($sql_query)) {
33 $sql_query_cpy = $sql_query;
34 unset($sql_query);
36 if (isset($disp_query)) {
37 $sql_query = (get_magic_quotes_gpc() ? stripslashes($disp_query) : $disp_query);
39 PMA_showMessage($message);
40 if (isset($goto_cpy)) {
41 $goto = $goto_cpy;
42 unset($goto_cpy);
44 if (isset($sql_query_cpy)) {
45 $sql_query = $sql_query_cpy;
46 unset($sql_query_cpy);
49 if (get_magic_quotes_gpc()) {
50 if (!empty($sql_query)) {
51 $sql_query = stripslashes($sql_query);
53 if (!empty($primary_key)) {
54 $primary_key = stripslashes($primary_key);
56 } // end if
59 /**
60 * Defines the url to return to in case of error in a sql statement
62 if (!isset($goto)) {
63 $goto = 'db_details.php3';
65 if ($goto != 'db_details.php3' && $goto != 'tbl_properties.php3') {
66 $err_url = $goto;
67 } else {
68 $err_url = $goto
69 . '?lang=' . $lang
70 . '&amp;convcharset=' . $convcharset
71 . '&amp;server=' . $server
72 . '&amp;db=' . urlencode($db)
73 . (($goto == 'tbl_properties.php3') ? '&amp;table=' . urlencode($table) : '');
77 /**
78 * Ensures db and table are valid, else moves to the "parent" script
80 require('./libraries/db_table_exists.lib.php3');
83 /**
84 * Sets parameters for links and displays top menu
86 $url_query = 'lang=' . $lang
87 . '&amp;convcharset=' . $convcharset
88 . '&amp;server=' . $server
89 . '&amp;db=' . urlencode($db)
90 . '&amp;table=' . urlencode($table)
91 . '&amp;goto=tbl_properties.php3';
93 require('./tbl_properties_table_info.php3');
94 echo '<br />';
97 /**
98 * Get the list of the fields of the current table
100 PMA_mysql_select_db($db);
101 $table_def = PMA_mysql_query('SHOW FIELDS FROM ' . PMA_backquote($table));
102 if (isset($primary_key)) {
103 $local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $primary_key;
104 $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
105 $row = PMA_mysql_fetch_array($result);
106 // No row returned
107 if (!$row) {
108 unset($row);
109 unset($primary_key);
110 $goto_cpy = $goto;
111 $goto = 'tbl_properties.php3'
112 . '?lang=' . $lang
113 . '&amp;convcharset=' . $convcharset
114 . '&amp;server=' . $server
115 . '&amp;db=' . urlencode($db)
116 . '&amp;table=' . urlencode($table)
117 . '&amp;$show_query=1'
118 . '&amp;sql_query=' . urlencode($local_query);
119 if (isset($sql_query)) {
120 $sql_query_cpy = $sql_query;
121 unset($sql_query);
123 $sql_query = $local_query;
124 PMA_showMessage($strEmptyResultSet);
125 $goto = $goto_cpy;
126 unset($goto_cpy);
127 if (isset($sql_query_cpy)) {
128 $sql_query = $sql_query_cpy;
129 unset($sql_query_cpy);
131 } // end if (no record returned)
133 else
135 $local_query = 'SELECT * FROM ' . PMA_backquote($table) . ' LIMIT 1';
136 $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
137 unset($row);
140 // <markus@noga.de>
141 // retrieve keys into foreign fields, if any
142 $cfgRelation = PMA_getRelationsParam();
143 $foreigners = ($cfgRelation['relwork'] ? PMA_getForeigners($db, $table) : FALSE);
147 * Displays the form
149 // loic1: autocomplete feature of IE kills the "onchange" event handler and it
150 // must be replaced by the "onpropertychange" one in this case
151 $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5)
152 ? 'onpropertychange'
153 : 'onchange';
154 // Had to put the URI because when hosted on an https server,
155 // some browsers send wrongly this form to the http server.
158 <!-- Change table properties form -->
159 <form method="post" action="tbl_replace.php3" name="insertForm">
160 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
161 <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
162 <input type="hidden" name="server" value="<?php echo $server; ?>" />
163 <input type="hidden" name="db" value="<?php echo htmlspecialchars($db); ?>" />
164 <input type="hidden" name="table" value="<?php echo $table; ?>" />
165 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
166 <input type="hidden" name="pos" value="<?php echo isset($pos) ? $pos : 0; ?>" />
167 <input type="hidden" name="session_max_rows" value="<?php echo isset($session_max_rows) ? $session_max_rows : ''; ?>" />
168 <input type="hidden" name="disp_direction" value="<?php echo isset($disp_direction) ? $disp_direction : ''; ?>" />
169 <input type="hidden" name="repeat_cells" value="<?php echo isset($repeat_cells) ? $repeat_cells : ''; ?>" />
170 <input type="hidden" name="dontlimitchars" value="<?php echo (isset($dontlimitchars) ? $dontlimitchars : 0); ?>" />
171 <input type="hidden" name="err_url" value="<?php echo urlencode($err_url); ?>" />
172 <input type="hidden" name="sql_query" value="<?php echo isset($sql_query) ? urlencode($sql_query) : ''; ?>" />
173 <?php
174 if (isset($primary_key)) {
176 <input type="hidden" name="primary_key" value="<?php echo urlencode($primary_key); ?>" />
177 <?php
179 echo "\n";
182 <table border="<?php echo $cfg['Border']; ?>">
183 <tr>
184 <th><?php echo $strField; ?></th>
185 <th><?php echo $strType; ?></th>
186 <?php
187 if ($cfg['ShowFunctionFields']) {
188 echo ' <th>' . $strFunction . '</th>' . "\n";
191 <th><?php echo $strNull; ?></th>
192 <th><?php echo $strValue; ?></th>
193 </tr>
195 <?php
196 // Set if we passed the first timestamp field
197 $timestamp_seen = 0;
198 $fields_cnt = mysql_num_rows($table_def);
200 // Set a flag here because the 'if' would not be valid in the loop
201 // if we set a value in some field
202 $insert_mode = (!isset($row) ? TRUE : FALSE);
204 for ($i = 0; $i < $fields_cnt; $i++) {
205 // Display the submit button after every 15 lines --swix
206 // (wanted to use an <a href="#bottom"> and <a name> instead,
207 // but it didn't worked because of the <base href>)
209 if ((($i % 15) == 0) && ($i != 0)) {
211 <tr>
212 <th colspan="5" align="right">
213 <input type="submit" value="<?php echo $strGo; ?>" />&nbsp;
214 </th>
215 </tr>
216 <?php
217 } // end if
218 echo "\n";
220 $row_table_def = PMA_mysql_fetch_array($table_def);
221 $field = $row_table_def['Field'];
222 // loic1: current date should not be set as default if the field is NULL
223 // for the current row
224 // lem9: but do not put here the current datetime if there is a default
225 // value (the real default value will be set in the
226 // Default value logic below)
227 if ($row_table_def['Type'] == 'datetime'
228 && (!isset($row_table_def['Default']))) {
229 // INSERT case
230 if ($insert_mode) {
231 $row[$field] = date('Y-m-d H:i:s', time());
233 // UPDATE case with an empty and not NULL value under PHP4
234 else if (empty($row[$field]) && function_exists('is_null')) {
235 $row[$field] = (is_null($row[$field]) ? $row[$field] : date('Y-m-d H:i:s', time()));
237 // UPDATE case with an empty value under PHP3
238 else if (empty($row[$field])) {
239 $row[$field] = date('Y-m-d H:i:s', time());
240 } // end if... else if... else if...
242 $len = (eregi('float|double', $row_table_def['Type']))
243 ? 100
244 : @mysql_field_len($result, $i);
245 $first_timestamp = 0;
247 $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
249 <tr>
250 <td align="center" bgcolor="<?php echo $bgcolor; ?>"><?php echo htmlspecialchars($field); ?></td>
251 <?php
252 echo "\n";
254 // The type column
255 $is_binary = eregi(' binary', $row_table_def['Type']);
256 $is_blob = eregi('blob', $row_table_def['Type']);
257 $is_char = eregi('char', $row_table_def['Type']);
258 $row_table_def['True_Type'] = ereg_replace('\\(.*', '', $row_table_def['Type']);
259 switch ($row_table_def['True_Type']) {
260 case 'set':
261 $type = 'set';
262 $type_nowrap = '';
263 break;
264 case 'enum':
265 $type = 'enum';
266 $type_nowrap = '';
267 break;
268 case 'timestamp':
269 if (!$timestamp_seen) { // can only occur once per table
270 $timestamp_seen = 1;
271 $first_timestamp = 1;
273 $type = $row_table_def['Type'];
274 $type_nowrap = ' nowrap="nowrap"';
275 break;
277 default:
278 $type = $row_table_def['Type'];
279 $type_nowrap = ' nowrap="nowrap"';
280 break;
283 <td align="center" bgcolor="<?php echo $bgcolor; ?>"<?php echo $type_nowrap; ?>><?php echo $type; ?></td>
284 <?php
285 echo "\n";
287 // Prepares the field value
288 if (isset($row)) {
289 // loic1: null field value
290 if (!isset($row[$field])) {
291 $row[$field] = 'NULL';
292 $special_chars = '';
293 $data = $row[$field];
294 } else {
295 // loic1: special binary "characters"
296 if ($is_binary || $is_blob) {
297 $row[$field] = str_replace("\x00", '\0', $row[$field]);
298 $row[$field] = str_replace("\x08", '\b', $row[$field]);
299 $row[$field] = str_replace("\x0a", '\n', $row[$field]);
300 $row[$field] = str_replace("\x0d", '\r', $row[$field]);
301 $row[$field] = str_replace("\x1a", '\Z', $row[$field]);
302 } // end if
303 $special_chars = htmlspecialchars($row[$field]);
304 $data = $row[$field];
305 } // end if... else...
306 // loic1: if a timestamp field value is not included in an update
307 // statement MySQL auto-update it to the current timestamp
308 $backup_field = ($row_table_def['True_Type'] == 'timestamp')
309 ? ''
310 : '<input type="hidden" name="fields_prev[' . urlencode($field) . ']" value="' . urlencode($row[$field]) . '" />';
311 } else {
312 // loic1: display default values
313 if (!isset($row_table_def['Default'])) {
314 $row_table_def['Default'] = '';
315 $data = 'NULL';
316 } else {
317 $data = $row_table_def['Default'];
319 $special_chars = htmlspecialchars($row_table_def['Default']);
320 $backup_field = '';
323 // The function column
324 // -------------------
325 // Change by Bernard M. Piller <bernard@bmpsystems.com>
326 // We don't want binary data to be destroyed
327 // Note: from the MySQL manual: "BINARY doesn't affect how the column is
328 // stored or retrieved" so it does not mean that the contents is
329 // binary
330 if ($cfg['ShowFunctionFields']) {
331 if (($cfg['ProtectBinary'] && $is_blob)
332 || ($cfg['ProtectBinary'] == 'all' && $is_binary)) {
333 echo ' <td align="center" bgcolor="'. $bgcolor . '">' . $strBinary . '</td>' . "\n";
334 } else if (strstr($row_table_def['True_Type'], 'enum') || strstr($row_table_def['True_Type'], 'set')) {
335 echo ' <td align="center" bgcolor="'. $bgcolor . '">--</td>' . "\n";
336 } else {
338 <td bgcolor="<?php echo $bgcolor; ?>">
339 <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); ?>">
340 <option></option>
341 <?php
342 echo "\n";
343 $selected = '';
344 for ($j = 0; $j < count($cfg['Functions']); $j++) {
345 // for default function = NOW() on first timestamp field
346 // -- swix/18jul01
347 $selected = ($first_timestamp && $cfg['Functions'][$j] == 'NOW')
348 ? ' selected="selected"'
349 : '';
350 echo ' ';
351 echo '<option' . $selected . '>' . $cfg['Functions'][$j] . '</option>' . "\n";
352 } // end for
353 unset($selected);
355 </select>
356 </td>
357 <?php
359 } // end if ($cfg['ShowFunctionFields'])
360 echo "\n";
362 // The null column
363 // ---------------
364 echo ' <td bgcolor="' . $bgcolor . '">' . "\n";
365 if (!(($cfg['ProtectBinary'] && $is_blob) || ($cfg['ProtectBinary'] == 'all' && $is_binary))
366 && $row_table_def['Null'] == 'YES') {
367 echo ' <input type="checkbox" tabindex="' . ((2 * $fields_cnt) + $i + 1) . '"'
368 . ' name="fields_null[' . urlencode($field) . ']"';
369 if ($data == 'NULL' && !$first_timestamp) {
370 echo ' checked="checked"';
372 $onclick = ' onclick="if (this.checked) {nullify(';
373 if (strstr($row_table_def['True_Type'], 'enum')) {
374 if (strlen($row_table_def['Type']) > 20) {
375 $onclick .= '1, ';
376 } else {
377 $onclick .= '2, ';
379 } else if (strstr($row_table_def['True_Type'], 'set')) {
380 $onclick .= '3, ';
381 } else if ($foreigners && isset($foreigners[$field])) {
382 $onclick .= '4, ';
383 } else {
384 $onclick .= '5, ';
386 $onclick .= '\'' . urlencode($field) . '\', \'' . md5($field) . '\'); this.checked = true}; return true" />' . "\n";
387 echo $onclick;
388 } else {
389 echo ' &nbsp;' . "\n";
391 echo ' </td>' . "\n";
393 // The value column (depends on type)
394 // ----------------
396 include('./libraries/get_foreign.lib.php3');
398 if (isset($disp) && $disp) {
400 <td bgcolor="<?php echo $bgcolor; ?>">
401 <?php echo $backup_field . "\n"; ?>
402 <input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="$foreign$" />
403 <select name="field_<?php echo md5($field); ?>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>">
404 <option value=""></option>
405 <?php
406 echo "\n";
407 while ($relrow = @PMA_mysql_fetch_array($disp)) {
408 $key = $relrow[$foreign_field];
409 $value = (($foreign_display != FALSE) ? '&nbsp;-&nbsp;' . htmlspecialchars($relrow[$foreign_display]) : '');
410 echo ' <option value="' . htmlspecialchars($key) . '"';
411 if ($key == $data) {
412 echo ' selected="selected"';
413 } // end if
414 echo '>' . htmlspecialchars($key) . $value . '</option>' . "\n";
415 } // end while
416 echo ' </select>' . "\n";
417 echo ' </td>' . "\n";
418 unset($disp);
420 else if (strstr($row_table_def['True_Type'], 'text')) {
422 <td bgcolor="<?php echo $bgcolor; ?>">
423 <?php echo $backup_field . "\n"; ?>
424 <textarea name="fields[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>"
425 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>"><?php echo $special_chars; ?></textarea>
426 </td>
427 <?php
428 echo "\n";
429 if (strlen($special_chars) > 32000) {
430 echo ' <td bgcolor="' . $bgcolor . '">' . $strTextAreaLength . '</td>' . "\n";
433 else if (strstr($row_table_def['True_Type'], 'enum')) {
434 $enum = str_replace('enum(', '', $row_table_def['Type']);
435 $enum = ereg_replace('\\)$', '', $enum);
436 $enum = explode('\',\'', substr($enum, 1, -1));
437 $enum_cnt = count($enum);
439 <td bgcolor="<?php echo $bgcolor; ?>">
440 <input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="$enum$" />
441 <?php
442 echo "\n" . ' ' . $backup_field;
444 // show dropdown or radio depend on length
445 if (strlen($row_table_def['Type']) > 20) {
446 echo "\n";
448 <select name="field_<?php echo md5($field); ?>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>">
449 <option value=""></option>
450 <?php
451 echo "\n";
453 for ($j = 0; $j < $enum_cnt; $j++) {
454 // Removes automatic MySQL escape format
455 $enum_atom = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $enum[$j]));
456 echo ' ';
457 echo '<option value="' . urlencode($enum_atom) . '"';
458 if ($data == $enum_atom
459 || ($data == '' && (!isset($primary_key) || $row_table_def['Null'] != 'YES')
460 && isset($row_table_def['Default']) && $enum_atom == $row_table_def['Default'])) {
461 echo ' selected="selected"';
463 echo '>' . htmlspecialchars($enum_atom) . '</option>' . "\n";
464 } // end for
467 </select>
468 <?php
469 } // end if
470 else {
471 echo "\n";
472 for ($j = 0; $j < $enum_cnt; $j++) {
473 // Removes automatic MySQL escape format
474 $enum_atom = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $enum[$j]));
475 echo ' ';
476 echo '<input type="radio" name="field_' . md5($field) . '[]" value="' . urlencode($enum_atom) . '" id="radio_field_' . $j . '" onclick="if (typeof(document.forms[\'insertForm\'].elements[\'fields_null[' . urlencode($field) . ']\']) != \'undefined\') {document.forms[\'insertForm\'].elements[\'fields_null[' . urlencode($field) .']\'].checked = false}"';
477 if ($data == $enum_atom
478 || ($data == '' && (!isset($primary_key) || $row_table_def['Null'] != 'YES')
479 && isset($row_table_def['Default']) && $enum_atom == $row_table_def['Default'])) {
480 echo ' checked="checked"';
482 echo 'tabindex="' . ($i + 1) . '" />' . "\n";
483 echo ' <label for="radio_field_' . $j . '">' . htmlspecialchars($enum_atom) . '</label>' . "\n";
484 } // end for
486 } // end else
487 echo "\n";
489 </td>
490 <?php
491 echo "\n";
493 else if (strstr($row_table_def['Type'], 'set')) {
494 $set = str_replace('set(', '', $row_table_def['Type']);
495 $set = ereg_replace('\)$', '', $set);
496 $set = explode(',', $set);
498 if (isset($vset)) {
499 unset($vset);
501 for ($vals = explode(',', $data); list($t, $k) = each($vals);) {
502 $vset[$k] = 1;
504 $size = min(4, count($set));
506 <td bgcolor="<?php echo $bgcolor; ?>">
507 <?php echo $backup_field . "\n"; ?>
508 <input type="hidden" name="fields[<?php echo urlencode($field); ?>]" value="$set$" />
509 <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); ?>" >
510 <?php
511 echo "\n";
512 $countset = count($set);
513 for ($j = 0; $j < $countset;$j++) {
514 $subset = substr($set[$j], 1, -1);
515 // Removes automatic MySQL escape format
516 $subset = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $subset));
517 echo ' ';
518 echo '<option value="'. urlencode($subset) . '"';
519 if (isset($vset[$subset]) && $vset[$subset]) {
520 echo ' selected="selected"';
522 echo '>' . htmlspecialchars($subset) . '</option>' . "\n";
523 } // end for
525 </select>
526 </td>
527 <?php
529 // Change by Bernard M. Piller <bernard@bmpsystems.com>
530 // We don't want binary data destroyed
531 else if ($is_binary || $is_blob) {
532 if (($cfg['ProtectBinary'] && $is_blob)
533 || ($cfg['ProtectBinary'] == 'all' && $is_binary)) {
534 echo "\n";
536 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
537 <?php echo $strBinaryDoNotEdit . "\n"; ?>
538 </td>
539 <?php
540 } else if ($is_blob) {
541 echo "\n";
543 <td bgcolor="<?php echo $bgcolor; ?>">
544 <?php echo $backup_field . "\n"; ?>
545 <textarea name="fields[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>"
546 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" ><?php echo $special_chars; ?></textarea>
547 </td>
548 <?php
549 } else {
550 if ($len < 4) {
551 $fieldsize = $maxlength = 4;
552 } else {
553 $fieldsize = (($len > 40) ? 40 : $len);
554 $maxlength = $len;
556 echo "\n";
558 <td bgcolor="<?php echo $bgcolor; ?>">
559 <?php echo $backup_field . "\n"; ?>
560 <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); ?>" />
561 </td>
562 <?php
563 } // end if...elseif...else
564 } // end else if
565 else {
566 // For char or varchar, respect the maximum length (M); for other
567 // types (int or float), the length is not a limit on the values that
568 // can be entered, so let's be generous (20) (we could also use the
569 // real limits for each numeric type)
570 if ($is_char) {
571 $fieldsize = (($len > 40) ? 40 : $len);
572 $maxlength = $len;
574 else {
575 $fieldsize = $maxlength = 20;
576 } // end if... else...
577 echo "\n";
579 <td bgcolor="<?php echo $bgcolor; ?>">
580 <?php echo $backup_field . "\n"; ?>
581 <?php
582 if ($is_char && isset($cfg['CharEditing']) && ($cfg['CharEditing'] == 'textarea')) {
583 echo "\n";
585 <textarea name="fields[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['CharTextareaRows']; ?>" cols="<?php echo $cfg['CharTextareaCols']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>"
586 <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($i + 1); ?>" ><?php echo $special_chars; ?></textarea>
587 <?php
588 } else {
589 echo "\n";
591 <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); ?>" />
592 <?php
594 echo "\n";
596 </td>
597 <?php
599 echo "\n";
601 </tr>
602 <?php
603 echo "\n";
604 } // end for
606 </table>
607 <br />
609 <table cellpadding="5">
610 <tr>
611 <td valign="middle" nowrap="nowrap">
612 <?php
613 if (isset($primary_key)) {
615 <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 />
616 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $strOr; ?><br />
617 <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>
618 <?php
619 } else {
620 echo "\n";
622 <input type="hidden" name="submit_type" value="<?php echo $strInsertAsNewRow; ?>" />
623 <?php
624 echo ' ' . $strInsertAsNewRow . "\n";
626 echo "\n";
628 // Defines whether "insert a new row after the current insert" should be
629 // checked or not (keep this choice sticky)
630 $checked = (!empty($message)) ? ' checked="checked"' : '';
632 </td>
633 <td valign="middle">
634 &nbsp;&nbsp;&nbsp;<b>-- <?php echo $strAnd; ?> --</b>&nbsp;&nbsp;&nbsp;
635 </td>
636 <td valign="middle" nowrap="nowrap">
637 <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 />
638 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $strOr; ?><br />
639 <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>
640 </td>
641 </tr>
643 <tr>
644 <td colspan="3" align="center" valign="middle">
645 <input type="submit" value="<?php echo $strGo; ?>" tabindex="<?php echo ((3 * $fields_cnt) + 5); ?>" />
646 </td>
647 </tr>
648 </table>
650 </form>
653 <?php
655 * Displays the footer
657 echo "\n";
658 require('./footer.inc.php3');