📄 sql.php
字号:
// fact that $zero_rows is sent for every case. // The $zero_rows containing $strSuccess and sent with // the form should not have priority over // errors like $strEmptyResultSet } elseif (!empty($zero_rows) && !$is_select) { $message = $zero_rows; } elseif (!empty($GLOBALS['show_as_php'])) { $message = $strPhp; } elseif (!empty($GLOBALS['validatequery'])) { $message = $strValidateSQL; } else { $message = $strEmptyResultSet; } $message .= ' ' . (isset($GLOBALS['querytime']) ? '(' . sprintf($strQueryTime, $GLOBALS['querytime']) . ')' : ''); if ($is_gotofile) { $goto = PMA_securePath($goto); // Checks for a valid target script if (isset($table) && $table == '') { unset($table); } if (isset($db) && $db == '') { unset($db); } $is_db = $is_table = false; if (strpos(' ' . $goto, 'tbl_properties') == 1) { if (!isset($table)) { $goto = 'db_details.php'; } else { $is_table = @PMA_DBI_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, true) . '\';', null, PMA_DBI_QUERY_STORE); if (!($is_table && @PMA_DBI_num_rows($is_table))) { $goto = 'db_details.php'; unset($table); } @PMA_DBI_free_result($is_table); } // end if... else... } if (strpos(' ' . $goto, 'db_details') == 1) { if (isset($table)) { unset($table); } if (!isset($db)) { $goto = 'main.php'; } else { $is_db = @PMA_DBI_select_db($db); if (!$is_db) { $goto = 'main.php'; unset($db); } } // end if... else... } // Loads to target script if (strpos(' ' . $goto, 'db_details') == 1 || strpos(' ' . $goto, 'tbl_properties') == 1) { $js_to_run = 'functions.js'; } if ($goto != 'main.php') { require_once './libraries/header.inc.php'; } $active_page = $goto; require './' . $goto; } else { PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . str_replace('&', '&', $goto) . '&message=' . urlencode($message)); } // end else exit(); } // end no rows returned // At least one row is returned -> displays a table with results else { // Displays the headers if (isset($show_query)) { unset($show_query); } if (isset($printview) && $printview == '1') { require_once './libraries/header_printview.inc.php'; } else { $js_to_run = 'functions.js'; unset($message); if (isset($table) && strlen($table)) { require './libraries/tbl_properties_common.php'; $url_query .= '&goto=tbl_properties.php&back=tbl_properties.php'; require './libraries/tbl_properties_table_info.inc.php'; require './libraries/tbl_properties_links.inc.php'; } elseif (isset($db) && strlen($db)) { require './libraries/db_details_common.inc.php'; require './libraries/db_details_db_info.inc.php'; } else { require './libraries/server_common.inc.php'; require './libraries/server_links.inc.php'; } } if (isset($db) && strlen($db)) { require_once './libraries/relation.lib.php'; $cfgRelation = PMA_getRelationsParam(); } // Gets the list of fields properties if (isset($result) && $result) { $fields_meta = PMA_DBI_get_fields_meta($result); $fields_cnt = count($fields_meta); } // Display previous update query (from tbl_replace) if (isset($disp_query) && $cfg['ShowSQL'] == true) { $tmp_sql_query = $GLOBALS['sql_query']; $GLOBALS['sql_query'] = $disp_query; PMA_showMessage($disp_message); $GLOBALS['sql_query'] = $tmp_sql_query; } // Displays the results in a table require_once './libraries/display_tbl.lib.php'; if (empty($disp_mode)) { // see the "PMA_setDisplayMode()" function in // libraries/display_tbl.lib.php $disp_mode = 'urdr111101'; } if (!isset($dontlimitchars)) { $dontlimitchars = 0; } // hide edit and delete links for information_schema if (PMA_MYSQL_INT_VERSION >= 50002 && isset($db) && $db == 'information_schema') { $disp_mode = 'nnnn110111'; } PMA_displayTable($result, $disp_mode, $analyzed_sql); PMA_DBI_free_result($result); // BEGIN INDEX CHECK See if indexes should be checked. if (isset($query_type) && $query_type == 'check_tbl' && isset($selected) && is_array($selected)) { foreach ($selected AS $idx => $tbl_name) { $indexes = $indexes_info = $indexes_data = array(); $tbl_ret_keys = PMA_get_indexes(urldecode($tbl_name), $err_url_0); PMA_extract_indexes($tbl_ret_keys, $indexes, $indexes_info, $indexes_data); $idx_collection = PMA_show_indexes(urldecode($tbl_name), $indexes, $indexes_info, $indexes_data, false); $check = PMA_check_indexes($idx_collection); if (!empty($check)) { ?><table border="0" cellpadding="2" cellspacing="0"> <tr> <td class="tblHeaders" colspan="7"><?php printf($strIndexWarningTable, urldecode($tbl_name)); ?></td> </tr> <?php echo $check; ?></table> <?php } } } // End INDEX CHECK if ($disp_mode[6] == '1' || $disp_mode[9] == '1') { echo "\n"; echo '<hr />' . "\n"; // Displays "Insert a new row" link if required if ($disp_mode[6] == '1') { $lnk_goto = 'sql.php?' . PMA_generate_common_url($db, $table) . '&pos=' . $pos . '&session_max_rows=' . $session_max_rows . '&disp_direction=' . $disp_direction . '&repeat_cells=' . $repeat_cells . '&dontlimitchars=' . $dontlimitchars . '&sql_query=' . urlencode($sql_query); $url_query = '?' . PMA_generate_common_url($db, $table) . '&pos=' . $pos . '&session_max_rows=' . $session_max_rows . '&disp_direction=' . $disp_direction . '&repeat_cells=' . $repeat_cells . '&dontlimitchars=' . $dontlimitchars . '&sql_query=' . urlencode($sql_query) . '&goto=' . urlencode($lnk_goto); echo ' <!-- Insert a new row -->' . "\n"; echo PMA_linkOrButton( 'tbl_change.php' . $url_query, ($cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_insrow.png" height="16" width="16" alt="' . $strInsertNewRow . '"/>' : '') . $strInsertNewRow, '', true, true, '') . "\n"; if ($disp_mode[9] == '1') { echo ' '; } echo "\n"; } // end insert new row // Displays "printable view" link if required if ($disp_mode[9] == '1') { $url_query = '?' . PMA_generate_common_url($db, $table) . '&pos=' . $pos . '&session_max_rows=' . $session_max_rows . '&disp_direction=' . $disp_direction . '&repeat_cells=' . $repeat_cells . '&printview=1' . '&sql_query=' . urlencode($sql_query); echo ' <!-- Print view -->' . "\n"; echo PMA_linkOrButton( 'sql.php' . $url_query . ((isset($dontlimitchars) && $dontlimitchars == '1') ? '&dontlimitchars=1' : ''), ($cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_print.png" height="16" width="16" alt="' . $strPrintView . '"/>' : '') . $strPrintView, '', true, true, 'print_view') . "\n"; if (!$dontlimitchars) { echo ' ' . "\n"; echo PMA_linkOrButton( 'sql.php' . $url_query . '&dontlimitchars=1', ($cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_print.png" height="16" width="16" alt="' . $strPrintViewFull . '"/>' : '') . $strPrintViewFull, '', true, true, 'print_view') . "\n"; } } // end displays "printable view" echo "\n"; } // Export link // (the url_query has extra parameters that won't be used to export) // (the single_table parameter is used in display_export.lib.php // to hide the SQL and the structure export dialogs) if (isset($analyzed_sql[0]) && $analyzed_sql[0]['querytype'] == 'SELECT' && !isset($printview)) { if (isset($analyzed_sql[0]['table_ref'][0]['table_true_name']) && !isset($analyzed_sql[0]['table_ref'][1]['table_true_name'])) { $single_table = '&single_table=true'; } else { $single_table = ''; } echo ' <!-- Export -->' . "\n"; echo ' ' . "\n"; echo PMA_linkOrButton( 'tbl_properties_export.php' . $url_query . '&unlim_num_rows=' . $unlim_num_rows . $single_table, ($cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_tblexport.png" height="16" width="16" alt="' . $strExport . '" />' : '') . $strExport, '', true, true, '') . "\n"; } // Bookmark Support if required if ($disp_mode[7] == '1' && (isset($cfg['Bookmark']) && $cfg['Bookmark']['db'] && $cfg['Bookmark']['table'] && empty($id_bookmark)) && !empty($sql_query)) { echo "\n"; $goto = 'sql.php?' . PMA_generate_common_url($db, $table) . '&pos=' . $pos . '&session_max_rows=' . $session_max_rows . '&disp_direction=' . $disp_direction . '&repeat_cells=' . $repeat_cells . '&dontlimitchars=' . $dontlimitchars . '&sql_query=' . urlencode($sql_query) . '&id_bookmark=1'; if ($disp_mode[3] == '1') { echo ' <i>' . $strOr . '</i>'; } else { echo '<br /><br />'; } ?><form action="sql.php" method="post" onsubmit="return emptyFormElements(this, 'fields[label]');"><?php echo PMA_generate_common_hidden_inputs(); ?><input type="hidden" name="goto" value="<?php echo $goto; ?>" /><input type="hidden" name="fields[dbase]" value="<?php echo htmlspecialchars($db); ?>" /><input type="hidden" name="fields[user]" value="<?php echo $cfg['Bookmark']['user']; ?>" /><input type="hidden" name="fields[query]" value="<?php echo urlencode(isset($complete_query) ? $complete_query : $sql_query); ?>" /><fieldset> <legend><?php echo ($cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_bookmark.png" width="16" height="16" alt="' . $strBookmarkThis . '" />' : '') . $strBookmarkThis;?> </legend> <div class="formelement"> <label for="fields_label_"><?php echo $strBookmarkLabel; ?>:</label> <input type="text" id="fields_label_" name="fields[label]" value="" /> </div> <div class="formelement"> <input type="checkbox" name="bkm_all_users" id="bkm_all_users" value="true" /> <label for="bkm_all_users"><?php echo $strBookmarkAllUsers; ?></label> </div> <div class="clearfloat"></div></fieldset><fieldset class="tblFooters"> <input type="submit" name="store_bkm" value="<?php echo $strBookmarkThis; ?>" /></fieldset></form> <?php } // end bookmark support // Do print the page if required if (isset($printview) && $printview == '1') { ?><script type="text/javascript" language="javascript">//<![CDATA[// Do print the pagewindow.onload = function(){ if (typeof(window.print) != 'undefined') { window.print(); }}//]]></script> <?php } // end print case } // end rows returned} // end executes the query/** * Displays the footer */require_once './libraries/footer.inc.php';?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -