/**
 * Function to check over array of indexes and look for common problems
 *
 * @param   array       Array of indexes
 * @param   boolean     Whether to output HTML in table layout
 *
 * @access  public
 * @return  string      Output HTML
 * @author  Garvin Hicking (pma@supergarv.de)
 */
function PMA_check_indexes($idx_collection, $table = true)
{
    $index_types = PMA_get_indextypes();
    $output = '';
    if (is_array($idx_collection) && isset($idx_collection['ALL'])) {
        foreach ($idx_collection['ALL'] as $w_keyname => $w_count) {
            if (isset($idx_collection['PRIMARY'][$w_keyname]) && (isset($idx_collection['INDEX'][$w_keyname]) || isset($idx_collection['UNIQUE'][$w_keyname]))) {
                $output .= PMA_index_warning(sprintf($GLOBALS['strIndexWarningPrimary'], htmlspecialchars($w_keyname)), $table);
            } elseif (isset($idx_collection['UNIQUE'][$w_keyname]) && isset($idx_collection['INDEX'][$w_keyname])) {
                $output .= PMA_index_warning(sprintf($GLOBALS['strIndexWarningUnique'], htmlspecialchars($w_keyname)), $table);
            }
            foreach ($index_types as $index_type) {
                if (isset($idx_collection[$index_type][$w_keyname]) && $idx_collection[$index_type][$w_keyname] > 1) {
                    $output .= PMA_index_warning(sprintf($GLOBALS['strIndexWarningMultiple'], $index_type, htmlspecialchars($w_keyname)), $table);
                }
            }
        }
    }
    return $output;
}
<?php

/* $Id: tbl_indexes.php,v 2.27 2005/11/18 12:50:49 cybot_tm Exp $ */
// vim: expandtab sw=4 ts=4 sts=4:
/**
 * Gets some core libraries
 */
require_once './libraries/common.lib.php';
require_once './libraries/tbl_indexes.lib.php';
/**
 * Defines the index types ("FULLTEXT" is available since MySQL 3.23.23)
 */
$index_types = PMA_get_indextypes();
$index_types_cnt = count($index_types);
/**
 * Ensures the db & table are valid, then loads headers and gets indexes
 * informations.
 * Skipped if this script is called by "tbl_properties.php"
 */
if (!defined('PMA_IDX_INCLUDED')) {
    // Not a valid db name -> back to the welcome page
    if (!empty($db)) {
        $is_db = PMA_DBI_select_db($db);
    }
    if (empty($db) || !$is_db) {
        PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'main.php?' . PMA_generate_common_url('', '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
        exit;
    }
    // Not a valid table name -> back to the default db_details sub-page
    if (!empty($table)) {
        $is_table = PMA_DBI_query('SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'', NULL, PMA_DBI_QUERY_STORE);
</label>
<input type="text" name="index" id="input_index_name" size="25"
    value="<?php 
    echo htmlspecialchars($index);
    ?>
" onfocus="this.select()" />
</div>

<div class="formelement">
<label for="select_index_type"><?php 
    echo $strIndexType;
    ?>
</label>
<select name="index_type" id="select_index_type" onchange="return checkIndexName()">
    <?php 
    foreach (PMA_get_indextypes() as $each_index_type) {
        if ($each_index_type === 'PRIMARY' && $index !== 'PRIMARY' && isset($indexes_info['PRIMARY'])) {
            // skip PRIMARY if there is already one in the table
            continue;
        }
        echo '                ' . '<option value="' . $each_index_type . '"' . ($index_type == $each_index_type ? ' selected="selected"' : '') . '>' . $each_index_type . '</option>' . "\n";
    }
    ?>
</select>
<?php 
    echo PMA_showMySQLDocu('SQL-Syntax', 'ALTER_TABLE');
    ?>
</div>


<br class="clearfloat" />