bug 619097
[phpmyadmin/crack.git] / sql.php3
blob704dd7129e2b79f7f6efe4e5f4502cce20293647
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 /**
6 * Gets some core libraries
7 */
8 require('./libraries/grab_globals.lib.php3');
9 require('./libraries/common.lib.php3');
11 /**
12 * Defines the url to return to in case of error in a sql statement
14 // Security checkings
15 if (!empty($goto)) {
16 $is_gotofile = ereg_replace('^([^?]+).*$', '\\1', $goto);
17 if (!@file_exists('./' . $is_gotofile)) {
18 unset($goto);
19 } else {
20 $is_gotofile = ($is_gotofile == $goto);
22 } // end if (security checkings)
24 if (empty($goto)) {
25 $goto = (empty($table)) ? $cfg['DefaultTabDatabase'] : $cfg['DefaultTabTable'];
26 $is_gotofile = TRUE;
27 } // end if
28 if (!isset($err_url)) {
29 $err_url = (!empty($back) ? $back : $goto)
30 . '?lang=' . $lang
31 . '&amp;convcharset=' . $convcharset
32 . '&amp;server=' . $server
33 . (isset($db) ? '&amp;db=' . urlencode($db) : '')
34 . ((strpos(' ' . $goto, 'db_details') != 1 && isset($table)) ? '&amp;table=' . urlencode($table) : '');
35 } // end if
37 /**
38 * Check rights in case of DROP DATABASE
40 * This test may be bypassed if $is_js_confirmed = 1 (already checked with js)
41 * but since a malicious user may pass this variable by url/form, we don't take
42 * into account this case.
44 if (!defined('PMA_CHK_DROP')
45 && !$cfg['AllowUserDropDatabase']
46 && eregi('DROP[[:space:]]+(IF EXISTS[[:space:]]+)?DATABASE[[:space:]]', $sql_query)) {
47 // Checks if the user is a Superuser
48 // TODO: set a global variable with this information
49 // loic1: optimized query
50 $result = @PMA_mysql_query('USE mysql');
51 if (PMA_mysql_error()) {
52 include('./header.inc.php3');
53 PMA_mysqlDie($strNoDropDatabases, '', '', $err_url);
54 } // end if
55 } // end if
58 /**
59 * Bookmark add
61 if (isset($store_bkm)) {
62 if (get_magic_quotes_gpc()) {
63 $fields['label'] = stripslashes($fields['label']);
65 include('./libraries/bookmark.lib.php3');
66 PMA_addBookmarks($fields, $cfg['Bookmark']);
67 header('Location: ' . $cfg['PmaAbsoluteUri'] . $goto);
68 } // end if
71 /**
72 * Gets the true sql query
74 // $sql_query has been urlencoded in the confirmation form for drop/delete
75 // queries or in the navigation bar for browsing among records
76 if (isset($btnDrop) || isset($navig)) {
77 $sql_query = urldecode($sql_query);
80 /**
81 * Reformat the query
84 $parsed_sql = PMA_SQP_parse((get_magic_quotes_gpc() ? stripslashes($sql_query) : $sql_query));
85 $analyzed_sql = PMA_SQP_analyze($parsed_sql);
86 $sql_query = PMA_SQP_formatHtml($parsed_sql, 'query_only');
88 // here we are sure that SELECT is uppercase
89 $is_select = eregi('^SELECT[[:space:]]+', $sql_query);
91 // If the query is a Select, extract the db and table names and modify
92 // $db and $table, to have correct page headers, links and left frame.
93 // db and table name may be enclosed with backquotes, db is optionnal,
94 // query may contain aliases.
95 // (todo: check for embedded comments...)
97 // (todo: if there are more than one table name in the Select:
98 // - do not extract the first table name
99 // - do not show a table name in the page header
100 // - do not display the sub-pages links)
102 if ($is_select) {
103 eregi('^SELECT[[:space:]]+(.*)[[:space:]]+FROM[[:space:]]+(`[^`]+`|[A-Za-z0-9_$]+)([\.]*)(`[^`]*`|[A-Za-z0-9_$]*)', $sql_query, $tmp);
105 if ($tmp[3] == '.') {
106 $prev_db = $db;
107 $db = str_replace('`', '', $tmp[2]);
108 $reload = ($db == $prev_db) ? 0 : 1;
109 $table = str_replace('`', '', $tmp[4]);
111 else {
112 $table = str_replace('`', '', $tmp[2]);
114 } // end if
118 * Sets or modifies the $goto variable if required
120 if ($goto == 'sql.php3') {
121 $goto = 'sql.php3'
122 . '?lang=' . $lang
123 . '&amp;convcharset=' . $convcharset
124 . '&amp;server=' . $server
125 . '&amp;db=' . urlencode($db)
126 . '&amp;table=' . urlencode($table)
127 . '&amp;pos=' . $pos
128 . '&amp;sql_query=' . urlencode($sql_query);
129 } // end if
133 * Go back to further page if table should not be dropped
135 if (isset($btnDrop) && $btnDrop == $strNo) {
136 if (!empty($back)) {
137 $goto = $back;
139 if ($is_gotofile) {
140 if (strpos(' ' . $goto, 'db_details') == 1 && !empty($table)) {
141 unset($table);
143 include('./' . ereg_replace('\.\.*', '.', $goto));
144 } else {
145 header('Location: ' . $cfg['PmaAbsoluteUri'] . str_replace('&amp;', '&', $goto));
147 exit();
148 } // end if
152 * Displays the confirm page if required
154 * This part of the script is bypassed if $is_js_confirmed = 1 (already checked
155 * with js) because possible security issue is not so important here: at most,
156 * the confirm message isn't displayed.
158 * Also bypassed if only showing php code.or validating a SQL query
160 if (!$cfg['Confirm']
161 || (isset($is_js_confirmed) && $is_js_confirmed)
162 || isset($btnDrop)
163 || !empty($GLOBALS['show_as_php'])
164 || !empty($GLOBALS['validatequery'])) {
165 $do_confirm = FALSE;
166 } else {
167 /* SQL-Parser-Analyzer */
168 $do_confirm = (eregi('DROP[[:space:]]+(IF[[:space:]]+EXISTS[[:space:]]+)?(TABLE|DATABASE[[:space:]])|ALTER[[:space:]]+TABLE[[:space:]]+((`[^`]+`)|([A-Za-z0-9_$]+))[[:space:]]+DROP[[:space:]]|DELETE[[:space:]]+FROM[[:space:]]', $sql_query));
171 if ($do_confirm) {
172 // already stripped at beginning of script
173 //$stripped_sql_query = (get_magic_quotes_gpc() ? stripslashes($sql_query) : $sql_query);
174 $stripped_sql_query = $sql_query;
175 include('./header.inc.php3');
176 echo $strDoYouReally . '&nbsp;:<br />' . "\n";
177 echo '<tt>' . htmlspecialchars($stripped_sql_query) . '</tt>&nbsp;?<br/>' . "\n";
179 <form action="sql.php3" method="post">
180 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
181 <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
182 <input type="hidden" name="server" value="<?php echo $server; ?>" />
183 <input type="hidden" name="db" value="<?php echo htmlspecialchars($db); ?>" />
184 <input type="hidden" name="table" value="<?php echo isset($table) ? htmlspecialchars($table) : ''; ?>" />
185 <input type="hidden" name="sql_query" value="<?php echo urlencode(addslashes($sql_query)); ?>" />
186 <input type="hidden" name="zero_rows" value="<?php echo isset($zero_rows) ? $zero_rows : ''; ?>" />
187 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
188 <input type="hidden" name="back" value="<?php echo isset($back) ? $back : ''; ?>" />
189 <input type="hidden" name="reload" value="<?php echo isset($reload) ? $reload : 0; ?>" />
190 <input type="hidden" name="show_query" value="<?php echo isset($show_query) ? $show_query : ''; ?>" />
191 <input type="submit" name="btnDrop" value="<?php echo $strYes; ?>" />
192 <input type="submit" name="btnDrop" value="<?php echo $strNo; ?>" />
193 </form>
194 <?php
195 echo "\n";
196 } // end if
200 * Executes the query and displays results
202 else {
203 if (!isset($sql_query)) {
204 $sql_query = '';
206 // already stripped at beginning of script
207 // else if (get_magic_quotes_gpc()) {
208 // $sql_query = stripslashes($sql_query);
210 // Defines some variables
211 // loic1: A table has to be created -> left frame should be reloaded
212 if ((!isset($reload) || $reload == 0)
213 && eregi('^CREATE TABLE[[:space:]]+(.*)', $sql_query)) {
214 $reload = 1;
216 // Gets the number of rows per page
217 if (!isset($session_max_rows)) {
218 $session_max_rows = $cfg['MaxRows'];
219 } else if ($session_max_rows != 'all') {
220 $cfg['MaxRows'] = $session_max_rows;
222 // Defines the display mode (horizontal/vertical) and header "frequency"
223 if (empty($disp_direction)) {
224 $disp_direction = $cfg['DefaultDisplay'];
226 if (empty($repeat_cells)) {
227 $repeat_cells = $cfg['RepeatCells'];
230 // SK -- Patch: $is_group added for use in calculation of total number of
231 // rows.
232 // $is_count is changed for more correct "LIMIT" clause
233 // appending in queries like
234 // "SELECT COUNT(...) FROM ... GROUP BY ..."
235 $is_explain = $is_count = $is_export = $is_delete = $is_insert = $is_affected = $is_show = $is_maint = $is_analyse = $is_group = $is_func = FALSE;
236 if ($is_select) { // see line 141
237 $is_group = eregi('[[:space:]]+(GROUP[[:space:]]+BY|HAVING|SELECT[[:space:]]+DISTINCT)[[:space:]]+', $sql_query);
239 $is_func = !$is_group && (eregi('[[:space:]]+(SUM|AVG|STD|STDDEV|MIN|MAX|BIT_OR|BIT_AND)\s*\(', $sql_query));
240 $is_count = !$is_group && (eregi('^SELECT[[:space:]]+COUNT\((.*\.+)?.*\)', $sql_query));
241 $is_export = (eregi('[[:space:]]+INTO[[:space:]]+OUTFILE[[:space:]]+', $sql_query));
242 $is_analyse = (eregi('[[:space:]]+PROCEDURE[[:space:]]+ANALYSE\(', $sql_query));
243 } else if (eregi('^EXPLAIN[[:space:]]+', $sql_query)) {
244 $is_explain = TRUE;
245 } else if (eregi('^DELETE[[:space:]]+', $sql_query)) {
246 $is_delete = TRUE;
247 $is_affected = TRUE;
248 } else if (eregi('^(INSERT|LOAD[[:space:]]+DATA|REPLACE)[[:space:]]+', $sql_query)) {
249 $is_insert = TRUE;
250 $is_affected = TRUE;
251 } else if (eregi('^UPDATE[[:space:]]+', $sql_query)) {
252 $is_affected = TRUE;
253 } else if (eregi('^SHOW[[:space:]]+', $sql_query)) {
254 $is_show = TRUE;
255 } else if (eregi('^(CHECK|ANALYZE|REPAIR|OPTIMIZE)[[:space:]]+TABLE[[:space:]]+', $sql_query)) {
256 $is_maint = TRUE;
259 // Do append a "LIMIT" clause?
260 if (isset($pos)
261 && (!$cfg['ShowAll'] || $session_max_rows != 'all')
262 && $is_select
263 && !($is_count || $is_export || $is_func || $is_analyse)
264 && eregi('[[:space:]]FROM[[:space:]]', $sql_query)
265 && !eregi('[[:space:]]LIMIT[[:space:]0-9,-]+$', $sql_query)) {
266 $sql_limit_to_append = " LIMIT $pos, ".$cfg['MaxRows'];
267 if (eregi('(.*)([[:space:]](PROCEDURE[[:space:]](.*)|FOR[[:space:]]+UPDATE|LOCK[[:space:]]+IN[[:space:]]+SHARE[[:space:]]+MODE))$', $sql_query, $regs)) {
268 $full_sql_query = $regs[1] . $sql_limit_to_append . $regs[2];
269 } else {
270 $full_sql_query = $sql_query . $sql_limit_to_append;
272 } else {
273 $full_sql_query = $sql_query;
274 } // end if...else
276 PMA_mysql_select_db($db);
278 // If the query is a DELETE query with no WHERE clause, get the number of
279 // rows that will be deleted (mysql_affected_rows will always return 0 in
280 // this case)
281 if ($is_delete
282 && eregi('^DELETE([[:space:]].+)?([[:space:]]FROM[[:space:]](.+))$', $sql_query, $parts)
283 && !eregi('[[:space:]]WHERE[[:space:]]', $parts[3])) {
284 $cnt_all_result = @PMA_mysql_query('SELECT COUNT(*) as count' . $parts[2]);
285 if ($cnt_all_result) {
286 $num_rows = PMA_mysql_result($cnt_all_result, 0, 'count');
287 mysql_free_result($cnt_all_result);
288 } else {
289 $num_rows = 0;
292 // Executes the query
293 // Only if we didn't ask to see the php code (mikebeck)
294 if (!empty($GLOBALS['show_as_php']) || !empty($GLOBALS['validatequery'])) {
295 unset($result);
296 $num_rows = 0;
298 else {
299 $result = @PMA_mysql_query($full_sql_query);
300 // Displays an error message if required and stop parsing the script
301 if (PMA_mysql_error()) {
302 $error = PMA_mysql_error();
303 include('./header.inc.php3');
304 $full_err_url = (ereg('^(db_details|tbl_properties)', $err_url))
305 ? $err_url . '&amp;show_query=1&amp;sql_query=' . urlencode($sql_query)
306 : $err_url;
307 PMA_mysqlDie($error, $full_sql_query, '', $full_err_url);
310 // Checks if the current database has changed
311 // This could happen if the user sends a query like "USE `database`;"
312 $res = PMA_mysql_query('SELECT DATABASE() AS "db";');
313 $row = PMA_mysql_fetch_array($res);
314 if ($db != $row['db']) {
315 $db = $row['db'];
316 $reload = 1;
318 @mysql_free_result($res);
319 unset($res);
320 unset($row);
322 // tmpfile remove after convert encoding appended by Y.Kawada
323 if (function_exists('PMA_kanji_file_conv')
324 && (isset($textfile) && file_exists($textfile))) {
325 unlink($textfile);
328 // Gets the number of rows affected/returned
329 if (!$is_affected) {
330 $num_rows = ($result) ? @mysql_num_rows($result) : 0;
331 } else if (!isset($num_rows)) {
332 $num_rows = @mysql_affected_rows();
335 // Counts the total number of rows for the same 'SELECT' query without the
336 // 'LIMIT' clause that may have been programatically added
337 if (empty($sql_limit_to_append)) {
338 $unlim_num_rows = $num_rows;
340 else if ($is_select) {
341 // SK -- Patch : correct calculations for GROUP BY, HAVING, DISTINCT
343 // Reads only the from-part of the query...
344 // NOTE: here the presence of LIMIT is impossible, HAVING and GROUP BY
345 // are necessary for correct calculation, and extra spaces and
346 // lowercase reserved words are removed, so we have a simple split
347 // pattern:
349 $array = split('[[:space:]]+(FROM|ORDER BY)[[:space:]]+', $sql_query);
351 // if $array[1] is empty here, there is an error in the query:
352 // "... FROM [ORDER BY ...]", but the query is already executed with
353 // success so this check is redundant???
355 if (!empty($array[1])) {
356 // ... and makes a count(*) to count the entries
357 // Special case: SELECT DISTINCT ... FROM ...
358 // the count of resulting rows can be found as:
359 // SELECT COUNT(DISTINCT ...) FROM ...
360 if (eregi('^SELECT DISTINCT(.*)', $array[0], $array_dist)) {
361 $count_what = 'DISTINCT ' . $array_dist[1];
362 } else {
363 $count_what = '*';
365 $count_query = 'SELECT COUNT(' . $count_what . ') AS count FROM ' . $array[1];
366 if ($cnt_all_result = mysql_query($count_query)) {
367 if ($is_group) {
368 $unlim_num_rows = @mysql_num_rows($cnt_all_result);
369 } else {
370 $unlim_num_rows = mysql_result($cnt_all_result, 0, 'count');
372 mysql_free_result($cnt_all_result);
374 } else {
375 $unlim_num_rows = 0;
377 } // end rows total count
378 } // end else "didn't ask to see php code"
380 // No rows returned -> move back to the calling page
381 if ($num_rows < 1 || $is_affected) {
382 if ($is_delete) {
383 $message = $strDeletedRows . '&nbsp;' . $num_rows;
384 } else if ($is_insert) {
385 $message = $strInsertedRows . '&nbsp;' . $num_rows;
386 } else if ($is_affected) {
387 $message = $strAffectedRows . '&nbsp;' . $num_rows;
388 } else if (!empty($zero_rows)) {
389 $message = $zero_rows;
390 } else if (!empty($GLOBALS['show_as_php'])) {
391 $message = $strPhp;
392 } else if (!empty($GLOBALS['validatequery'])) {
393 $message = $strValidateSQL;
394 } else {
395 $message = $strEmptyResultSet;
398 if ($is_gotofile) {
399 $goto = ereg_replace('\.\.*', '.', $goto);
400 // Checks for a valid target script
401 if (isset($table) && $table == '') {
402 unset($table);
404 if (isset($db) && $db == '') {
405 unset($db);
407 $is_db = $is_table = FALSE;
408 if (strpos(' ' . $goto, 'tbl_properties') == 1) {
409 if (!isset($table)) {
410 $goto = 'db_details.php3';
411 } else {
412 $is_table = @PMA_mysql_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'');
413 if (!($is_table && @mysql_numrows($is_table))) {
414 $goto = 'db_details.php3';
415 unset($table);
417 } // end if... else...
419 if (strpos(' ' . $goto, 'db_details') == 1) {
420 if (isset($table)) {
421 unset($table);
423 if (!isset($db)) {
424 $goto = 'main.php3';
425 } else {
426 $is_db = @PMA_mysql_select_db($db);
427 if (!$is_db) {
428 $goto = 'main.php3';
429 unset($db);
431 } // end if... else...
433 // Loads to target script
434 if (strpos(' ' . $goto, 'db_details') == 1
435 || strpos(' ' . $goto, 'tbl_properties') == 1) {
436 $js_to_run = 'functions.js';
438 if ($goto != 'main.php3') {
439 include('./header.inc.php3');
441 include('./' . $goto);
442 } // end if file_exist
443 else {
444 header('Location: ' . $cfg['PmaAbsoluteUri'] . str_replace('&amp;', '&', $goto) . '&message=' . urlencode($message));
445 } // end else
446 exit();
447 } // end no rows returned
449 // At least one row is returned -> displays a table with results
450 else {
451 // Displays the headers
452 if (isset($show_query)) {
453 unset($show_query);
455 if (isset($printview) && $printview == '1') {
456 include('./header_printview.inc.php3');
457 } else {
458 $js_to_run = 'functions.js';
459 unset($message);
460 if (!empty($table)) {
461 include('./tbl_properties_common.php3');
462 $url_query .= '&amp;goto=tbl_properties.php3&amp;back=tbl_properties.php3';
463 include('./tbl_properties_table_info.php3');
465 else {
466 include('./db_details_common.php3');
467 include('./db_details_db_info.php3');
469 include('./libraries/relation.lib.php3');
470 $cfgRelation = PMA_getRelationsParam();
473 // Gets the list of fields properties
474 if (isset($result) && $result) {
475 while ($field = PMA_mysql_fetch_field($result)) {
476 $fields_meta[] = $field;
478 $fields_cnt = count($fields_meta);
480 // Displays the results in a table
481 include('./libraries/display_tbl.lib.php3');
482 if (empty($disp_mode)) {
483 // see the "PMA_setDisplayMode()" function in
484 // libraries/display_tbl.lib.php3
485 $disp_mode = 'urdr111101';
487 if (!isset($dontlimitchars)) {
488 $dontlimitchars = 0;
491 PMA_displayTable($result, $disp_mode, $analyzed_sql);
492 mysql_free_result($result);
494 if ($disp_mode[6] == '1' || $disp_mode[9] == '1') {
495 echo "\n";
496 echo '<p>' . "\n";
498 // Displays "Insert a new row" link if required
499 if ($disp_mode[6] == '1') {
500 $lnk_goto = 'sql.php3'
501 . '?lang=' . $lang
502 . '&amp;convcharset=' . $convcharset
503 . '&amp;server=' . $server
504 . '&amp;db=' . urlencode($db)
505 . '&amp;table=' . urlencode($table)
506 . '&amp;pos=' . $pos
507 . '&amp;session_max_rows=' . $session_max_rows
508 . '&amp;disp_direction=' . $disp_direction
509 . '&amp;repeat_cells=' . $repeat_cells
510 . '&amp;dontlimitchars=' . $dontlimitchars
511 . '&amp;sql_query=' . urlencode($sql_query);
512 $url_query = '?lang=' . $lang
513 . '&amp;convcharset=' . $convcharset
514 . '&amp;server=' . $server
515 . '&amp;db=' . urlencode($db)
516 . '&amp;table=' . urlencode($table)
517 . '&amp;pos=' . $pos
518 . '&amp;session_max_rows=' . $session_max_rows
519 . '&amp;disp_direction=' . $disp_direction
520 . '&amp;repeat_cells=' . $repeat_cells
521 . '&amp;dontlimitchars=' . $dontlimitchars
522 . '&amp;sql_query=' . urlencode($sql_query)
523 . '&amp;goto=' . urlencode($lnk_goto);
525 echo ' <!-- Insert a new row -->' . "\n"
526 . ' <a href="tbl_change.php3' . $url_query . '">' . $strInsertNewRow . '</a>';
527 if ($disp_mode[9] == '1') {
528 echo '<br />';
530 echo "\n";
531 } // end insert new row
533 // Displays "printable view" link if required
534 if ($disp_mode[9] == '1') {
535 $url_query = '?lang=' . $lang
536 . '&amp;convcharset=' . $convcharset
537 . '&amp;server=' . $server
538 . '&amp;db=' . urlencode($db)
539 . '&amp;table=' . urlencode($table)
540 . '&amp;pos=' . $pos
541 . '&amp;session_max_rows=' . $session_max_rows
542 . '&amp;disp_direction=' . $disp_direction
543 . '&amp;repeat_cells=' . $repeat_cells
544 . '&amp;printview=1'
545 . ((isset($dontlimitchars) && $dontlimitchars == '1') ? '&amp;dontlimitchars=1' : '')
546 . '&amp;sql_query=' . urlencode($sql_query);
547 echo ' <!-- Print view -->' . "\n"
548 . ' <a href="sql.php3' . $url_query . '" target="print_view">' . $strPrintView . '</a>' . "\n";
549 } // end displays "printable view"
551 echo '</p>' . "\n";
554 // Bookmark Support if required
555 if ($disp_mode[7] == '1'
556 && ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table'] && empty($id_bookmark))
557 && !empty($sql_query)) {
558 echo "\n";
560 $goto = 'sql.php3'
561 . '?lang=' . $lang
562 . '&amp;convcharset=' . $convcharset
563 . '&amp;server=' . $server
564 . '&amp;db=' . urlencode($db)
565 . '&amp;table=' . urlencode($table)
566 . '&amp;pos=' . $pos
567 . '&amp;session_max_rows=' . $session_max_rows
568 . '&amp;disp_direction=' . $disp_direction
569 . '&amp;repeat_cells=' . $repeat_cells
570 . '&amp;dontlimitchars=' . $dontlimitchars
571 . '&amp;sql_query=' . urlencode($sql_query)
572 . '&amp;id_bookmark=1';
574 <!-- Bookmark the query -->
575 <form action="sql.php3" method="post" onsubmit="return emptyFormElements(this, 'fields[label]');">
576 <?php
577 echo "\n";
578 if ($disp_mode[3] == '1') {
579 echo ' <i>' . $strOr . '</i>' . "\n";
582 <br /><br />
583 <?php echo $strBookmarkLabel; ?>&nbsp;:
584 <input type="hidden" name="server" value="<?php echo $server; ?>" />
585 <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
586 <input type="hidden" name="fields[dbase]" value="<?php echo htmlspecialchars($db); ?>" />
587 <input type="hidden" name="fields[user]" value="<?php echo $cfg['Bookmark']['user']; ?>" />
588 <input type="hidden" name="fields[query]" value="<?php echo urlencode($sql_query); ?>" />
589 <input type="text" name="fields[label]" value="" />
590 <input type="submit" name="store_bkm" value="<?php echo $strBookmarkThis; ?>" />
591 </form>
592 <?php
593 } // end bookmark support
595 // Do print the page if required
596 if (isset($printview) && $printview == '1') {
597 echo "\n";
599 <script type="text/javascript" language="javascript1.2">
600 <!--
601 // Do print the page
602 if (typeof(window.print) != 'undefined') {
603 window.print();
605 //-->
606 </script>
607 <?php
608 } // end print case
609 } // end rows returned
611 } // end executes the query
612 echo "\n\n";
616 * Displays the footer
618 require('./footer.inc.php3');