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

📄 tbl_change.php

📁 WEBGAME源码,有架设说明,只是非常简单
💻 PHP
📖 第 1 页 / 共 3 页
字号:
<?php/** * vim: expandtab sw=4 ts=4 sts=4: * @version $Id: tbl_change.php 9937 2007-02-06 15:02:14Z cybot_tm $ *//** * Gets the variables sent or posted to this script and displays the header */require_once './libraries/common.lib.php';/** * Sets global variables. * Here it's better to use a if, instead of the '?' operator * to avoid setting a variable to '' when it's not present in $_REQUEST */if (isset($_REQUEST['pos'])) {    $pos =  $_REQUEST['pos'];}if (isset($_REQUEST['session_max_rows'])) {    $session_max_rows = $_REQUEST['session_max_rows'];}if (isset($_REQUEST['disp_direction'])) {    $disp_direction = $_REQUEST['disp_direction'];}if (isset($_REQUEST['repeat_cells'])) {    $repeat_cells = $_REQUEST['repeat_cells'];}if (isset($_REQUEST['dontlimitchars'])) {    $dontlimitchars = $_REQUEST['dontlimitchars'];}if (isset($_REQUEST['primary_key'])) {    $primary_key = $_REQUEST['primary_key'];}if (isset($_REQUEST['sql_query'])) {    $sql_query = $_REQUEST['sql_query'];}if (isset($_REQUEST['ShowFunctionFields'])) {    $cfg['ShowFunctionFields'] = $_REQUEST['ShowFunctionFields'];}$js_to_run = 'tbl_change.js';require_once './libraries/header.inc.php';require_once './libraries/relation.lib.php'; // foreign keysrequire_once './libraries/file_listing.php'; // file listing/** * Displays the query submitted and its result */if (! empty($disp_message)) {    if (! isset($disp_query)) {        $disp_query     = null;    }    PMA_showMessage($disp_message, $disp_query);}/** * Defines the url to return to in case of error in a sql statement * (at this point, $goto might be set but empty) */if (empty($goto)) {    $goto    = 'db_sql.php';}/** * @todo check if we could replace by "db_|tbl_" */if (!preg_match('@^(db|tbl)_@', $goto)) {    $err_url = $goto . "?" . PMA_generate_common_url($db) . "&amp;sql_query=" . urlencode($sql_query);} else {    $err_url = $goto . '?'             . PMA_generate_common_url($db)             . ((preg_match('@^(tbl_)@', $goto)) ? '&amp;table=' . urlencode($table) : '');}/** * Ensures db and table are valid, else moves to the "parent" script */require_once './libraries/db_table_exists.lib.php';/** * Sets parameters for links */$url_query = PMA_generate_common_url($db, $table)           . '&amp;goto=tbl_sql.php';require_once './libraries/tbl_info.inc.php';/* Get comments */$comments_map = array();if ($GLOBALS['cfg']['ShowPropertyComments']) {    require_once './libraries/relation.lib.php';    require_once './libraries/transformations.lib.php';    $cfgRelation = PMA_getRelationsParam();    if ($cfgRelation['commwork'] || PMA_MYSQL_INT_VERSION >= 40100) {        $comments_map = PMA_getComments($db, $table);    }}/** * Displays top menu links */require_once './libraries/tbl_links.inc.php';/** * Get the analysis of SHOW CREATE TABLE for this table */$show_create_table = PMA_DBI_fetch_value(        'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table),        0, 1 );$analyzed_sql = PMA_SQP_analyze( PMA_SQP_parse( $show_create_table ) );unset($show_create_table);/** * Get the list of the fields of the current table */PMA_DBI_select_db($db);$table_def = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';', null, PMA_DBI_QUERY_STORE);if (isset($primary_key)) {    if (is_array($primary_key)) {        $primary_key_array = $primary_key;    } else {        $primary_key_array = array(0 => $primary_key);    }    $row = array();    $result = array();    foreach ($primary_key_array as $rowcount => $primary_key) {        $local_query             = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' WHERE ' . $primary_key . ';';        $result[$rowcount]       = PMA_DBI_query($local_query, null, PMA_DBI_QUERY_STORE);        $row[$rowcount]          = PMA_DBI_fetch_assoc($result[$rowcount]);        $primary_keys[$rowcount] = str_replace('\\', '\\\\', $primary_key);        // No row returned        if (!$row[$rowcount]) {            unset($row[$rowcount], $primary_key_array[$rowcount]);            PMA_showMessage($strEmptyResultSet, $local_query);            echo "\n";            require_once './libraries/footer.inc.php';        } // end if (no record returned)    }} else {    $result = PMA_DBI_query('SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' LIMIT 1;', null, PMA_DBI_QUERY_STORE);    unset($row);}// <markus@noga.de>// retrieve keys into foreign fields, if any$cfgRelation = PMA_getRelationsParam();$foreigners  = ($cfgRelation['relwork'] ? PMA_getForeigners($db, $table) : FALSE);/** * Displays the form */// loic1: autocomplete feature of IE kills the "onchange" event handler and it//        must be replaced by the "onpropertychange" one in this case$chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5)                 ? 'onpropertychange'                 : 'onchange';// Had to put the URI because when hosted on an https server,// some browsers send wrongly this form to the http server.?><?php if ($cfg['CtrlArrowsMoving']) { ?><!-- Set on key handler for moving using by Ctrl+arrows --><script src="./js/keyhandler.js" type="text/javascript" language="javascript"></script><script type="text/javascript" language="javascript">//<![CDATA[var switch_movement = 0;document.onkeydown = onKeyDownArrowsHandler;//]]></script><?php } ?><!-- Change table properties form --><form method="post" action="tbl_replace.php" name="insertForm" <?php if ($is_upload) { echo ' enctype="multipart/form-data"'; } ?>>    <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>    <input type="hidden" name="goto" value="<?php echo htmlspecialchars($goto); ?>" />    <input type="hidden" name="pos" value="<?php echo isset($pos) ? $pos : 0; ?>" />    <input type="hidden" name="session_max_rows" value="<?php echo isset($session_max_rows) ? $session_max_rows : ''; ?>" />    <input type="hidden" name="disp_direction" value="<?php echo isset($disp_direction) ? $disp_direction : ''; ?>" />    <input type="hidden" name="repeat_cells" value="<?php echo isset($repeat_cells) ? $repeat_cells : ''; ?>" />    <input type="hidden" name="dontlimitchars" value="<?php echo (isset($dontlimitchars) ? $dontlimitchars : 0); ?>" />    <input type="hidden" name="err_url" value="<?php echo htmlspecialchars($err_url); ?>" />    <input type="hidden" name="sql_query" value="<?php echo isset($sql_query) ? htmlspecialchars($sql_query) : ''; ?>" /><?phpif (isset($primary_key_array)) {    foreach ($primary_key_array as $primary_key) {        ?>    <input type="hidden" name="primary_key[]" value="<?php echo htmlspecialchars(trim($primary_key)); ?>" /><?php    }}echo "\n";if ($cfg['PropertiesIconic'] == true) {    // We need to copy the value or else the == 'both' check will always return true    $propicon = (string)$cfg['PropertiesIconic'];    if ($propicon == 'both') {        $iconic_spacer = '<div class="nowrap">';    } else {        $iconic_spacer = '';    }    $titles['Browse']     = $iconic_spacer . '<img width="16" height="16" src="' . $pmaThemeImage . 'b_browse.png" alt="' . $strBrowseForeignValues . '" title="' . $strBrowseForeignValues . '" border="0" />';    if ($propicon == 'both') {        $titles['Browse']        .= '&nbsp;' . $strBrowseForeignValues . '</div>';    }} else {    $titles['Browse']        = $strBrowseForeignValues;}// Set if we passed the first timestamp field$timestamp_seen = 0;$fields_cnt     = PMA_DBI_num_rows($table_def);// Set a flag here because the 'if' would not be valid in the loop// if we set a value in some field$insert_mode = (!isset($row) ? TRUE : FALSE);if ($insert_mode) {    $loop_array  = array();    for ($i = 0; $i < $cfg['InsertRows']; $i++) {        $loop_array[] = FALSE;    }} else {    $loop_array  = $row;}while ($trow = PMA_DBI_fetch_assoc($table_def)) {    $trow_table_def[] = $trow;}$tabindex = 0;$tabindex_for_function = +1000;$tabindex_for_null     = +2000;$tabindex_for_value    = 0;$o_rows   = 0;$biggest_max_file_size = 0;// user can toggle the display of Function column// (currently does not work for multi-edits)$url_params['db'] = $db;$url_params['table'] = $table;if (isset($primary_key)) {    $url_params['primary_key'] = trim($primary_key);}if (isset($sql_query)) {    $url_params['sql_query'] = $sql_query;}if (! $cfg['ShowFunctionFields']) {    $this_url_params = array_merge($url_params,        array('ShowFunctionFields' => 1));    echo $strShow . ' : <a href="tbl_change.php' . PMA_generate_common_url($this_url_params) . '">' . $strFunction . '</a>' . "\n";}foreach ($loop_array as $vrowcount => $vrow) {    if ($vrow === FALSE) {        unset($vrow);    }    if ($insert_mode) {        $jsvkey = $vrowcount;        $browse_foreigners_uri = '&amp;pk=' . $vrowcount;    } else {        $jsvkey = htmlspecialchars(trim($primary_keys[$vrowcount]));        $browse_foreigners_uri = '&amp;pk=' . urlencode(trim($primary_keys[$vrowcount]));    }    $vkey = '[multi_edit][' . $jsvkey . ']';    $vresult = (isset($result) && is_array($result) && isset($result[$vrowcount]) ? $result[$vrowcount] : $result);    if ($insert_mode && $vrowcount > 0) {        echo '<input type="checkbox" checked="checked" name="insert_ignore_' . $vrowcount . '" id="insert_ignore_check_' . $vrowcount . '" />';        echo '<label for="insert_ignore_check_' . $vrowcount . '">' . $strIgnore . '</label><br />' . "\n";    }?>    <table>        <tr>            <th><?php echo $strField; ?></th>            <th><?php echo $strType; ?></th><?php    if ($cfg['ShowFunctionFields']) {        $this_url_params = array_merge($url_params,            array('ShowFunctionFields' => 0));        echo '          <th><a href="tbl_change.php' . PMA_generate_common_url($this_url_params) . '" title="' . $strHide . '">' . $strFunction . '</a></th>' . "\n";    }?>            <th><?php echo $strNull; ?></th>            <th><?php echo $strValue; ?></th>        </tr><?php    // garvin: For looping on multiple rows, we need to reset any variable used inside the loop to indicate sth.    $timestamp_seen = 0;    unset($first_timestamp);    // Sets a multiplier used for input-field counts (as zero cannot be used, advance the counter plus one)    $m_rows = $o_rows + 1;    $odd_row = true;    for ($i = 0; $i < $fields_cnt; $i++) {        // Display the submit button after every 15 lines --swix        // (wanted to use an <a href="#bottom"> and <a name> instead,        // but it didn't worked because of the <base href>)        if ((($o_rows * $fields_cnt + $i) % 15 == 0) && ($i + $o_rows != 0)) {            ?>        <tr>            <th colspan="5" align="right" class="tblFooters">                <input type="submit" value="<?php echo $strGo; ?>" />&nbsp;            </th>        </tr>            <?php        } // end if        echo "\n";        $row_table_def   = $trow_table_def[$i];        $row_table_def['True_Type'] = preg_replace('@\(.*@s', '', $row_table_def['Type']);        $field      = $row_table_def['Field'];        $field_html = htmlspecialchars($field);        $field_md5  = md5($field);        $unnillify_trigger = $chg_evt_handler . "=\"return unNullify('" . PMA_escapeJsString($field_html) . "', '" . PMA_escapeJsString($jsvkey) . "')\"";        $field_name_appendix =  $vkey . '[' . $field_html . ']';        $field_name_appendix_md5 = $field_md5 . $vkey . '[]';        // removed previous PHP3-workaround that caused a problem with        // field names like '000'        //$rowfield = $field;        // d a t e t i m e        //        // loic1: current date should not be set as default if the field is NULL        //        for the current row        // lem9:  but do not put here the current datetime if there is a default        //        value (the real default value will be set in the        //        Default value logic below)

⌨️ 快捷键说明

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