⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sql.php

📁 phpMyAdmin图形界面化操作,我已经配置好了,只要把解要压缩后的文件放到站点下就可以用了
💻 PHP
📖 第 1 页 / 共 2 页
字号:
    unset($current_db);     */    // tmpfile remove after convert encoding appended by Y.Kawada    if (function_exists('PMA_kanji_file_conv')        && (isset($textfile) && file_exists($textfile))) {        unlink($textfile);    }    // Counts the total number of rows for the same 'SELECT' query without the    // 'LIMIT' clause that may have been programatically added    if (empty($sql_limit_to_append)) {        $unlim_num_rows         = $num_rows;        // if we did not append a limit, set this to get a correct        // "Showing rows..." message        //$_SESSION['userconf']['max_rows'] = 'all';    } elseif ($is_select) {        //    c o u n t    q u e r y        // If we are "just browsing", there is only one table,        // and no where clause (or just 'WHERE 1 '),        // so we do a quick count (which uses MaxExactCount)        // because SQL_CALC_FOUND_ROWS        // is not quick on large InnoDB tables        // but do not count again if we did it previously        // due to $find_real_end == true        if (!$is_group         && !isset($analyzed_sql[0]['queryflags']['union'])         && !isset($analyzed_sql[0]['table_ref'][1]['table_name'])         && (empty($analyzed_sql[0]['where_clause'])           || $analyzed_sql[0]['where_clause'] == '1 ')         && !isset($find_real_end)        ) {            // "j u s t   b r o w s i n g"            $unlim_num_rows = PMA_Table::countRecords($db, $table, true);        } else { // n o t   " j u s t   b r o w s i n g "            // add select expression after the SQL_CALC_FOUND_ROWS            // for UNION, just adding SQL_CALC_FOUND_ROWS            // after the first SELECT works.            // take the left part, could be:            // SELECT            // (SELECT            $count_query = PMA_SQP_formatHtml($parsed_sql, 'query_only', 0, $analyzed_sql[0]['position_of_first_select'] + 1);            $count_query .= ' SQL_CALC_FOUND_ROWS ';            // add everything that was after the first SELECT            $count_query .= PMA_SQP_formatHtml($parsed_sql, 'query_only', $analyzed_sql[0]['position_of_first_select']+1);            // ensure there is no semicolon at the end of the            // count query because we'll probably add            // a LIMIT 1 clause after it            $count_query = rtrim($count_query);            $count_query = rtrim($count_query, ';');            // if using SQL_CALC_FOUND_ROWS, add a LIMIT to avoid            // long delays. Returned count will be complete anyway.            // (but a LIMIT would disrupt results in an UNION)            if (!isset($analyzed_sql[0]['queryflags']['union'])) {                $count_query .= ' LIMIT 1';            }            // run the count query            PMA_DBI_try_query($count_query);            // if (mysql_error()) {            // void.            // I tried the case            // (SELECT `User`, `Host`, `Db`, `Select_priv` FROM `db`)            // UNION (SELECT `User`, `Host`, "%" AS "Db",            // `Select_priv`            // FROM `user`) ORDER BY `User`, `Host`, `Db`;            // and although the generated count_query is wrong            // the SELECT FOUND_ROWS() work! (maybe it gets the            // count from the latest query that worked)            //            // another case where the count_query is wrong:            // SELECT COUNT(*), f1 from t1 group by f1            // and you click to sort on count(*)            // }            $unlim_num_rows = PMA_DBI_fetch_value('SELECT FOUND_ROWS()');        } // end else "just browsing"    } else { // not $is_select         $unlim_num_rows         = 0;    } // end rows total count    // garvin: if a table or database gets dropped, check column comments.    if (isset($purge) && $purge == '1') {        require_once './libraries/relation_cleanup.lib.php';        if (strlen($table) && strlen($db)) {            PMA_relationsCleanupTable($db, $table);        } elseif (strlen($db)) {            PMA_relationsCleanupDatabase($db);        } else {            // garvin: VOID. No DB/Table gets deleted.        } // end if relation-stuff    } // end if ($purge)    // garvin: If a column gets dropped, do relation magic.    if (isset($cpurge) && $cpurge == '1' && isset($purgekey)     && strlen($db) && strlen($table) && !empty($purgekey)) {        require_once './libraries/relation_cleanup.lib.php';        PMA_relationsCleanupColumn($db, $table, $purgekey);    } // end if column PMA_* purge} // end else "didn't ask to see php code"// No rows returned -> move back to the calling pageif (0 == $num_rows || $is_affected) {    if ($is_delete) {        $message = PMA_Message::success('strRowsDeleted');        $message->addParam($num_rows);    } elseif ($is_insert) {        if ($is_replace) {            /* For replace we get DELETED + INSERTED row count, so we have to call it affected */            $message = PMA_Message::success('strRowsAffected');            $message->addParam($num_rows);        } else {            $message = PMA_Message::success('strRowsInserted');            $message->addParam($num_rows);        }        $insert_id = PMA_DBI_insert_id();        if ($insert_id != 0) {            // insert_id is id of FIRST record inserted in one insert, so if we inserted multiple rows, we had to increment this            $message->addMessage('[br]');            // need to use a temporary because the Message class            // currently supports adding parameters only to the first            // message            $_inserted = PMA_Message::notice('strInsertedRowId');            $_inserted->addParam($insert_id + $num_rows - 1);            $message->addMessage($_inserted);        }    } elseif ($is_affected) {        $message = PMA_Message::success('strRowsAffected');        $message->addParam($num_rows);        // Ok, here is an explanation for the !$is_select.        // The form generated by sql_query_form.lib.php        // and db_sql.php has many submit buttons        // on the same form, and some confusion arises from the        // 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 = PMA_Message::rawSuccess($zero_rows);    } elseif (!empty($GLOBALS['show_as_php'])) {        $message = PMA_Message::success('strShowingPhp');    } elseif (isset($GLOBALS['show_as_php'])) {        /* User disable showing as PHP, query is only displayed */        $message = PMA_Message::notice('strShowingSQL');    } elseif (!empty($GLOBALS['validatequery'])) {        $message = PMA_Message::notice('strValidateSQL');    } else {        $message = PMA_Message::success('strEmptyResultSet');    }    if (isset($GLOBALS['querytime'])) {        $_querytime = PMA_Message::notice('strQueryTime');        $_querytime->addParam($GLOBALS['querytime']);        $message->addMessage('(');        $message->addMessage($_querytime);        $message->addMessage(')');    }    if ($is_gotofile) {        $goto = PMA_securePath($goto);        // Checks for a valid target script        $is_db = $is_table = false;        include 'libraries/db_table_exists.lib.php';        if (strpos($goto, 'tbl_') === 0 && ! $is_table) {            if (strlen($table)) {                $table = '';            }            $goto = 'db_sql.php';        }        if (strpos($goto, 'db_') === 0 && ! $is_db) {            if (strlen($db)) {                $db = '';            }            $goto = 'main.php';        }        // Loads to target script        if (strpos($goto, 'db_') === 0         || strpos($goto, 'tbl_') === 0) {            $GLOBALS['js_include'][] = 'functions.js';        }        if ($goto != 'main.php') {            require_once './libraries/header.inc.php';        }        $active_page = $goto;        require './' . $goto;    } else {        // avoid a redirect loop when last record was deleted        if (0 == $num_rows && 'sql.php' == $cfg['DefaultTabTable']) {            $goto = str_replace('sql.php','tbl_structure.php',$goto);        }        PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . str_replace('&amp;', '&', $goto) . '&message=' . urlencode($message));    } // end else    exit();} // end no rows returned// At least one row is returned -> displays a table with resultselse {    // Displays the headers    if (isset($show_query)) {        unset($show_query);    }    if (isset($printview) && $printview == '1') {        require_once './libraries/header_printview.inc.php';    } else {        $GLOBALS['js_include'][] = 'functions.js';        unset($message);        if (strlen($table)) {            require './libraries/tbl_common.php';            $url_query .= '&amp;goto=tbl_sql.php&amp;back=tbl_sql.php';            require './libraries/tbl_info.inc.php';            require './libraries/tbl_links.inc.php';        } elseif (strlen($db)) {            require './libraries/db_common.inc.php';            require './libraries/db_info.inc.php';        } else {            require './libraries/server_common.inc.php';            require './libraries/server_links.inc.php';        }    }    if (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) {        PMA_showMessage($disp_message, $disp_query, 'success');    }    if (isset($profiling_results)) {        PMA_profilingResults($profiling_results);    }    // Displays the results in a table    if (empty($disp_mode)) {        // see the "PMA_setDisplayMode()" function in        // libraries/display_tbl.lib.php        $disp_mode = 'urdr111101';    }    // hide edit and delete links for information_schema    if ($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) {            $check = PMA_Index::findDuplicates($tbl_name, $db);            if (! empty($check)) {                printf($strIndexWarningTable, $tbl_name);                echo $check;            }        }    } // End INDEX CHECK    // Bookmark support if required    if ($disp_mode[7] == '1'        && (! empty($cfg['Bookmark']) && empty($id_bookmark))        && !empty($sql_query)) {        echo "\n";        $goto = 'sql.php?'              . PMA_generate_common_url($db, $table)              . '&amp;sql_query=' . urlencode($sql_query)              . '&amp;id_bookmark=1';        ?><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">//<![CDATA[// Do print the pagewindow.onload = function(){    if (typeof(window.print) != 'undefined') {        window.print();    }}//]]></script>        <?php    } // end print case} // end rows returned/** * Displays the footer */require_once './libraries/footer.inc.php';?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -