' . "\n";
} // end of the 'PMA_displayPrivTable()' function
/**
* Displays the fields used by the "new user" form as well as the
* "change login information / copy user" form.
*
* @param string are we creating a new user or are we just changing one?
* (allowed values: 'new', 'change')
* @param int the indenting level of the code
*
* @global array the phpMyAdmin configuration
* @global ressource the database connection
*
* @return void
*/
function PMA_displayLoginInformationFields($mode = 'new', $indent = 0)
{
global $cfg, $userlink;
$spaces = '';
for ($i = 0; $i < $indent; $i++) {
$spaces .= ' ';
}
echo $spaces . '
' . "\n"
. $spaces . '
' . "\n"
. $spaces . ' ' . "\n"
. $spaces . '
' . "\n"
. $spaces . '
' . "\n"
. $spaces . ' ' . "\n"
. $spaces . '
' . "\n"
. $spaces . '
' . "\n"
. $spaces . ' ' . "\n"
. $spaces . '
' . "\n"
. $spaces . '
' . "\n"
. $spaces . '
' . "\n"
. $spaces . '
' . "\n"
. $spaces . ' ' . "\n"
. $spaces . '
' . "\n"
. $spaces . '
' . "\n"
. $spaces . ' ' . "\n"
. $spaces . '
' . "\n"
. $spaces . '
' . "\n"
. $spaces . ' ' . "\n"
. $spaces . '
' . "\n"
. $spaces . '
' . "\n"
. $spaces . '
' . "\n"
. $spaces . '
' . "\n"
. $spaces . ' ' . "\n"
. $spaces . '
' . "\n"
. $spaces . '
' . "\n"
. $spaces . ' ' . "\n"
. $spaces . '
' . "\n"
. $spaces . '
' . "\n"
. $spaces . ' ' . "\n"
. $spaces . '
' . "\n"
. $spaces . '
' . "\n"
. $spaces . '
' . "\n"
. $spaces . '
' . "\n"
. $spaces . ' ' . "\n"
. $spaces . '
' . "\n"
. $spaces . '
' . "\n"
. $spaces . '
' . "\n"
. $spaces . ' ' . "\n"
. $spaces . '
' . "\n"
. $spaces . '
' . "\n";
} // end of the 'PMA_displayUserAndHostFields()' function
/**
* Changes / copies a user, part I
*/
if (!empty($change_copy)) {
$user_host_condition = ' WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($old_username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($old_hostname, 'quoted') . ';';
$res = PMA_DBI_query('SELECT * FROM `mysql`.`user` ' . $user_host_condition);
if (!$res) {
$message = $strNoUsersFound;
unset($change_copy);
} else {
$row = PMA_DBI_fetch_assoc($res);
extract($row, EXTR_OVERWRITE);
// Recent MySQL versions have the field "Password" in mysql.user,
// so the previous extract creates $Password but this script
// uses $password
if (!isset($password) && isset($Password)) {
$password=$Password;
}
PMA_DBI_free_result($res);
$queries = array();
}
}
/**
* Adds a user
* (Changes / copies a user, part II)
*/
if (!empty($adduser_submit) || !empty($change_copy)) {
unset($sql_query);
if ($pred_username == 'any') {
$username = '';
}
switch ($pred_hostname) {
case 'any':
$hostname = '%';
break;
case 'localhost':
$hostname = 'localhost';
break;
case 'hosttable':
$hostname = '';
break;
case 'thishost':
$res = PMA_DBI_query('SELECT USER();');
$row = PMA_DBI_fetch_row($res);
PMA_DBI_free_result($res);
unset($res);
$hostname = substr($row[0], (strrpos($row[0], '@') + 1));
unset($row);
break;
}
$res = PMA_DBI_query('SELECT \'foo\' FROM `user` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($hostname, 'quoted') . ';', NULL, PMA_DBI_QUERY_STORE);
if (PMA_DBI_num_rows($res) == 1) {
PMA_DBI_free_result($res);
$message = sprintf($strUserAlreadyExists, '[i]\'' . $username . '\'@\'' . $hostname . '\'[/i]');
$adduser = 1;
} else {
PMA_DBI_free_result($res);
$real_sql_query = 'GRANT ' . join(', ', PMA_extractPrivInfo()) . ' ON *.* TO \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\'';
if ($pred_password != 'none' && $pred_password != 'keep') {
$pma_pw_hidden = '';
for ($i = 0; $i < strlen($pma_pw); $i++) {
$pma_pw_hidden .= '*';
}
$sql_query = $real_sql_query . ' IDENTIFIED BY \'' . $pma_pw_hidden . '\'';
$real_sql_query .= ' IDENTIFIED BY \'' . $pma_pw . '\'';
} else {
if ($pred_password == 'keep' && !empty($password)) {
$real_sql_query .= ' IDENTIFIED BY PASSWORD \'' . $password . '\'';
}
$sql_query = $real_sql_query;
}
if ((isset($Grant_priv) && $Grant_priv == 'Y') || (PMA_MYSQL_INT_VERSION >= 40002 && (isset($max_questions) || isset($max_connections) || isset($max_updates)))) {
$real_sql_query .= 'WITH';
$sql_query .= 'WITH';
if (isset($Grant_priv) && $Grant_priv == 'Y') {
$real_sql_query .= ' GRANT OPTION';
$sql_query .= ' GRANT OPTION';
}
if (PMA_MYSQL_INT_VERSION >= 40002) {
if (isset($max_questions)) {
$real_sql_query .= ' MAX_QUERIES_PER_HOUR ' . (int)$max_questions;
$sql_query .= ' MAX_QUERIES_PER_HOUR ' . (int)$max_questions;
}
if (isset($max_connections)) {
$real_sql_query .= ' MAX_CONNECTIONS_PER_HOUR ' . (int)$max_connections;
$sql_query .= ' MAX_CONNECTIONS_PER_HOUR ' . (int)$max_connections;
}
if (isset($max_updates)) {
$real_sql_query .= ' MAX_UPDATES_PER_HOUR ' . (int)$max_updates;
$sql_query .= ' MAX_UPDATES_PER_HOUR ' . (int)$max_updates;
}
}
}
$real_sql_query .= ';';
$sql_query .= ';';
if (empty($change_copy)) {
PMA_DBI_try_query($real_sql_query) or PMA_mysqlDie(PMA_DBI_getError(), $sql_query);
$message = $strAddUserMessage;
} else {
$queries[] = $real_sql_query;
// we put the query containing the hidden password in
// $queries_for_display, at the same position occupied
// by the real query in $queries
$tmp_count = count($queries);
$queries_for_display[$tmp_count - 1] = $sql_query;
}
unset($res, $real_sql_query);
}
}
/**
* Changes / copies a user, part III
*/
if (!empty($change_copy)) {
$user_host_condition = ' WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($old_username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($old_hostname, 'quoted') . ';';
$res = PMA_DBI_query('SELECT * FROM `mysql`.`db`' . $user_host_condition );
while ($row = PMA_DBI_fetch_assoc($res)) {
$queries[] = 'GRANT ' . join(', ', PMA_extractPrivInfo($row)) . ' ON `' . $row['Db'] . '`.* TO \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\'' . ($row['Grant_priv'] == 'Y' ? ' WITH GRANT OPTION' : '') . ';';
}
PMA_DBI_free_result($res);
$res = PMA_DBI_query('SELECT `Db`, `Table_name`, `Table_priv` FROM `mysql`.`tables_priv`' . $user_host_condition, $userlink, PMA_DBI_QUERY_STORE);
while ($row = PMA_DBI_fetch_assoc($res)) {
$res2 = PMA_DBI_QUERY('SELECT `Column_name`, `Column_priv` FROM `mysql`.`columns_priv` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($old_username), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($old_hostname, 'quoted') . ' AND ' . PMA_convert_using('Db') . ' = ' . PMA_convert_using($row['Db'], 'quoted') . ' AND ' . PMA_convert_using('Table_name') . ' = ' . PMA_convert_using($row['Table_name'], 'quoted') . ';', NULL, PMA_DBI_QUERY_STORE);
$tmp_privs1 = PMA_extractPrivInfo($row);
$tmp_privs2 = array(
'Select' => array(),
'Insert' => array(),
'Update' => array(),
'References' => array()
);
while ($row2 = PMA_DBI_fetch_assoc($res2)) {
$tmp_array = explode(',', $row2['Column_priv']);
if (in_array('Select', $tmp_array)) {
$tmp_privs2['Select'][] = $row2['Column_name'];
}
if (in_array('Insert', $tmp_array)) {
$tmp_privs2['Insert'][] = $row2['Column_name'];
}
if (in_array('Update', $tmp_array)) {
$tmp_privs2['Update'][] = $row2['Column_name'];
}
if (in_array('References', $tmp_array)) {
$tmp_privs2['References'][] = $row2['Column_name'];
}
unset($tmp_array);
}
if (count($tmp_privs2['Select']) > 0 && !in_array('SELECT', $tmp_privs1)) {
$tmp_privs1[] = 'SELECT (`' . join('`, `', $tmp_privs2['Select']) . '`)';
}
if (count($tmp_privs2['Insert']) > 0 && !in_array('INSERT', $tmp_privs1)) {
$tmp_privs1[] = 'INSERT (`' . join('`, `', $tmp_privs2['Insert']) . '`)';
}
if (count($tmp_privs2['Update']) > 0 && !in_array('UPDATE', $tmp_privs1)) {
$tmp_privs1[] = 'UPDATE (`' . join('`, `', $tmp_privs2['Update']) . '`)';
}
if (count($tmp_privs2['References']) > 0 && !in_array('REFERENCES', $tmp_privs1)) {
$tmp_privs1[] = 'REFERENCES (`' . join('`, `', $tmp_privs2['References']) . '`)';
}
unset($tmp_privs2);
$queries[] = 'GRANT ' . join(', ', $tmp_privs1) . ' ON `' . $row['Db'] . '`.`' . $row['Table_name'] . '` TO \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\'' . (in_array('Grant', explode(',', $row['Table_priv'])) ? ' WITH GRANT OPTION' : '') . ';';
}
}
/**
* Updates privileges
*/
if (!empty($update_privs)) {
// escaping a wildcard character in a GRANT is only accepted at the global
// or database level, not at table level; this is why I remove
// the escaping character
// Note: in the phpMyAdmin list of Database-specific privileges,
// we will have for example
// test\_db SELECT (this one is for privileges on a db level)
// test_db USAGE (this one is for table-specific privileges)
//
// It looks curious but reflects the way MySQL works
if (empty($dbname)) {
$db_and_table = '*.*';
} else {
if (!empty($tablename)) {
$db_and_table = str_replace('\\','',PMA_backquote($dbname))
. '.' . PMA_backquote($tablename);
} else {
// do not remove the escaping character when working at db level
$db_and_table = PMA_backquote($dbname)
. '.*';
}
}
$sql_query0 = 'REVOKE ALL PRIVILEGES ON ' . $db_and_table . ' FROM \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\';';
if (!isset($Grant_priv) || $Grant_priv != 'Y') {
$sql_query1 = 'REVOKE GRANT OPTION ON ' . $db_and_table . ' FROM \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\';';
}
$sql_query2 = 'GRANT ' . join(', ', PMA_extractPrivInfo()) . ' ON ' . $db_and_table . ' TO \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\'';
if ((isset($Grant_priv) && $Grant_priv == 'Y') || (empty($dbname) && PMA_MYSQL_INT_VERSION >= 40002 && (isset($max_questions) || isset($max_connections) || isset($max_updates)))) {
$sql_query2 .= 'WITH';
if (isset($Grant_priv) && $Grant_priv == 'Y') {
$sql_query2 .= ' GRANT OPTION';
}
if (PMA_MYSQL_INT_VERSION >= 40002) {
if (isset($max_questions)) {
$sql_query2 .= ' MAX_QUERIES_PER_HOUR ' . (int)$max_questions;
}
if (isset($max_connections)) {
$sql_query2 .= ' MAX_CONNECTIONS_PER_HOUR ' . (int)$max_connections;
}
if (isset($max_updates)) {
$sql_query2 .= ' MAX_UPDATES_PER_HOUR ' . (int)$max_updates;
}
}
}
$sql_query2 .= ';';
if (!PMA_DBI_try_query($sql_query0)) { // this query may fail, but this does not matter :o)
unset($sql_query0);
}
if (isset($sql_query1) && !PMA_DBI_try_query($sql_query1)) { // this one may fail, too...
unset($sql_query1);
}
PMA_DBI_query($sql_query2);
$sql_query = (isset($sql_query0) ? $sql_query0 . ' ' : '')
. (isset($sql_query1) ? $sql_query1 . ' ' : '')
. $sql_query2;
$message = sprintf($strUpdatePrivMessage, '\'' . $username . '\'@\'' . $hostname . '\'');
}
/**
* Revokes Privileges
*/
if (!empty($revokeall)) {
$db_and_table = PMA_backquote($dbname) . '.' . (empty($tablename) ? '*' : PMA_backquote($tablename));
$sql_query0 = 'REVOKE ALL PRIVILEGES ON ' . $db_and_table . ' FROM \'' . $username . '\'@\'' . $hostname . '\';';
$sql_query1 = 'REVOKE GRANT OPTION ON ' . $db_and_table . ' FROM \'' . $username . '\'@\'' . $hostname . '\';';
PMA_DBI_query($sql_query0);
if (!PMA_DBI_try_query($sql_query1)) { // this one may fail, too...
unset($sql_query1);
}
$sql_query = $sql_query0 . (isset($sql_query1) ? ' ' . $sql_query1 : '');
$message = sprintf($strRevokeMessage, '\'' . $username . '\'@\'' . $hostname . '\'');
if (empty($tablename)) {
unset($dbname);
} else {
unset($tablename);
}
}
/**
* Updates the password
*/
if (!empty($change_pw)) {
if ($nopass == 1) {
$sql_query = 'SET PASSWORD FOR \'' . $username . '\'@\'' . $hostname . '\' = \'\';';
PMA_DBI_query($sql_query);
$message = sprintf($strPasswordChanged, '\'' . $username . '\'@\'' . $hostname . '\'');
} else if (empty($pma_pw) || empty($pma_pw2)) {
$message = $strPasswordEmpty;
} else if ($pma_pw != $pma_pw2) {
$message = $strPasswordNotSame;
} else {
$hidden_pw = '';
for ($i = 0; $i < strlen($pma_pw); $i++) {
$hidden_pw .= '*';
}
$local_query = 'SET PASSWORD FOR \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\' = PASSWORD(\'' . PMA_sqlAddslashes($pma_pw) . '\')';
$sql_query = 'SET PASSWORD FOR \'' . PMA_sqlAddslashes($username) . '\'@\'' . $hostname . '\' = PASSWORD(\'' . $hidden_pw . '\')';
PMA_DBI_try_query($local_query) or PMA_mysqlDie(PMA_DBI_getError(), $sql_query);
$message = sprintf($strPasswordChanged, '\'' . $username . '\'@\'' . $hostname . '\'');
}
}
/**
* Deletes users
* (Changes / copies a user, part IV)
*/
$user_host_separator = chr(27);
if (!empty($delete) || (!empty($change_copy) && $mode < 4)) {
if (!empty($change_copy)) {
$selected_usr = array($old_username . $user_host_separator . $old_hostname);
} else {
$queries = array();
}
for ($i = 0; isset($selected_usr[$i]); $i++) {
list($this_user, $this_host) = explode($user_host_separator, $selected_usr[$i]);
$queries[] = '# ' . sprintf($strDeleting, '\'' . $this_user . '\'@\'' . $this_host . '\'') . ' ...';
if ($mode == 2) {
// The SHOW GRANTS query may fail if the user has not been loaded
// into memory
$res = PMA_DBI_try_query('SHOW GRANTS FOR \'' . PMA_sqlAddslashes($this_user) . '\'@\'' . $this_host . '\';');
if ($res) {
$queries[] = 'REVOKE ALL PRIVILEGES ON *.* FROM \'' . PMA_sqlAddslashes($this_user) . '\'@\'' . $this_host . '\';';
while ($row = PMA_DBI_fetch_row($res)) {
$this_table = substr($row[0], (strpos($row[0], 'ON') + 3), (strpos($row[0], ' TO ') - strpos($row[0], 'ON') - 3));
if ($this_table != '*.*') {
$queries[] = 'REVOKE ALL PRIVILEGES ON ' . $this_table . ' FROM \'' . PMA_sqlAddslashes($this_user) . '\'@\'' . $this_host . '\';';
if (strpos($row[0], 'WITH GRANT OPTION')) {
$queries[] = 'REVOKE GRANT OPTION ON ' . $this_table . ' FROM \'' . PMA_sqlAddslashes($this_user) . '\'@\'' . $this_host . '\';';
}
}
unset($this_table);
}
PMA_DBI_free_result($res);
}
unset($res);
}
$queries[] = 'DELETE FROM `user` WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($this_user), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($this_host, 'quoted') . ';';
if ($mode != 2) {
// If we REVOKE the table grants, we should not need to modify the
// `db`, `tables_priv` and `columns_priv` tables manually...
$user_host_condition = ' WHERE ' . PMA_convert_using('User') . ' = ' . PMA_convert_using(PMA_sqlAddslashes($this_user), 'quoted') . ' AND ' . PMA_convert_using('Host') . ' = ' . PMA_convert_using($this_host, 'quoted') . ';';
$queries[] = 'DELETE FROM `db`' . $user_host_condition;
$queries[] = 'DELETE FROM `tables_priv`' . $user_host_condition;
$queries[] = 'DELETE FROM `columns_priv`' . $user_host_condition;
}
if (!empty($drop_users_db)) {
$queries[] = 'DROP DATABASE IF EXISTS ' . PMA_backquote($this_user) . ';';
}
}
if (empty($change_copy)) {
if (empty($queries)) {
$message = $strError . ': ' . $strDeleteNoUsersSelected;
} else {
if ($mode == 3) {
$queries[] = '# ' . $strReloadingThePrivileges . ' ...';
$queries[] = 'FLUSH PRIVILEGES;';
}
foreach ($queries as $sql_query) {
if ($sql_query{0} != '#') {
PMA_DBI_query($sql_query, $userlink);
}
}
$sql_query = join("\n", $queries);
$message = $strUsersDeleted;
}
unset($queries);
}
}
/**
* Changes / copies a user, part V
*/
if (!empty($change_copy)) {
$tmp_count = -1;
foreach ($queries as $sql_query) {
$tmp_count++;
if ($sql_query{0} != '#') {
PMA_DBI_query($sql_query);
}
// when there is a query containing a hidden password, take it
// instead of the real query sent
if (isset($queries_for_display[$tmp_count])) {
$queries[$tmp_count] = $queries_for_display[$tmp_count];
}
}
$message = $strSuccess;
$sql_query = join("\n", $queries);
}
/**
* Reloads the privilege tables into memory
*/
if (!empty($flush_privileges)) {
$sql_query = 'FLUSH PRIVILEGES;';
PMA_DBI_query($sql_query);
$message = $strPrivilegesReloaded;
}
/**
* Displays the links
*/
require('./server_links.inc.php');
/**
* Displays the page
*/
if (empty($adduser) && empty($checkprivs)) {
if (!isset($username)) {
// No username is given --> display the overview
echo '
' . "\n";
$oldPrivTables = FALSE;
if (PMA_MYSQL_INT_VERSION >= 40002) {
$sql_query = 'SELECT `User`, `Host`, IF(`Password` = ' . (PMA_MYSQL_INT_VERSION >= 40100 ? '_latin1 ' : '') . '\'\', \'N\', \'Y\') AS \'Password\', `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Reload_priv`, `Shutdown_priv`, `Process_priv`, `File_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Show_db_priv`, `Super_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Execute_priv`, `Repl_slave_priv`, `Repl_client_priv` FROM `user` ';
// the strtolower() is because sometimes the User field
// might be BINARY, so LIKE would be case sensitive
if (isset($initial)) {
$sql_query .= " WHERE " . PMA_convert_using('User')
. " LIKE " . PMA_convert_using($initial . '%', 'quoted')
. " OR ". PMA_convert_using('User')
. " LIKE " . PMA_convert_using(strtolower($initial) . '%', 'quoted');
}
$sql_query .= ' ORDER BY `User` ASC, `Host` ASC;';
$res = PMA_DBI_try_query($sql_query, NULL, PMA_DBI_QUERY_STORE);
if (!$res) {
// the query failed! This may have two reasons:
// - the user has not enough privileges
// - the privilege tables use a structure of an earlier version.
$oldPrivTables = TRUE;
}
}
if (empty($res) || PMA_MYSQL_INT_VERSION < 40002) {
$sql_query = 'SELECT `User`, `Host`, IF(`Password` = ' . (PMA_MYSQL_INT_VERSION >= 40100 ? '_latin1 ' : '') . '\'\', \'N\', \'Y\') AS \'Password\', `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Index_priv`, `Alter_priv`, `Create_priv`, `Drop_priv`, `Grant_priv`, `References_priv`, `Reload_priv`, `Shutdown_priv`, `Process_priv`, `File_priv` FROM `user`';
if (isset($initial)) {
$sql_query .= " WHERE " . PMA_convert_using('User')
. " LIKE " . PMA_convert_using($initial . '%', 'quoted')
. " OR ". PMA_convert_using('User')
. " LIKE " . PMA_convert_using(strtolower($initial) . '%', 'quoted');
}
$sql_query .= ' ORDER BY `User` ASC, `Host` ASC;';
$res = PMA_DBI_try_query($sql_query, NULL, PMA_DBI_QUERY_STORE);
if (!$res) {
// the query failed! This may have two reasons:
// - the user has not enough privileges
// - the privilege tables use a structure of an earlier version.
$oldPrivTables = TRUE;
}
}
if (!$res) {
echo '' . $strNoPrivileges . '' . "\n";
PMA_DBI_free_result($res);
unset($res);
} else {
if ($oldPrivTables) {
// rabus: This message is hardcoded because I will replace it by
// a automatic repair feature soon.
echo '
' . "\n"
. ' Warning: Your privilege table structure seem to be older than this MySQL version! ' . "\n"
. ' Please run the script mysql_fix_privilege_tables that should be included in your MySQL server distribution to solve this problem!' . "\n"
. '
' . "\n";
}
/**
* Displays the initials
*/
// for all initials, even non A-Z
$array_initials = array();
// initialize to FALSE the letters A-Z
for ($letter_counter = 1; $letter_counter < 27; $letter_counter++) {
$array_initials[chr($letter_counter + 64)] = FALSE;
}
$initials = PMA_DBI_try_query('SELECT DISTINCT UPPER(LEFT(' . PMA_convert_using('User') . ',1)) FROM `user` ORDER BY `User` ASC', NULL, PMA_DBI_QUERY_STORE);
while (list($tmp_initial) = PMA_DBI_fetch_row($initials)) {
$array_initials[$tmp_initial] = TRUE;
}
// Display the initials, which can be any characters, not
// just letters. For letters A-Z, we add the non-used letters
// as greyed out.
uksort($array_initials, "strnatcasecmp");
reset($array_initials);
echo '
';
foreach ($array_initials as $tmp_initial => $initial_was_found) {
if ($initial_was_found) {
echo '