merge Loic's version
This commit is contained in:
111
main.php3
111
main.php3
@@ -2,15 +2,12 @@
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets some core libraries and displays a top message if required
|
||||
* TODO: The included script aren't yet xhtml1.0 compliant
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
require('./header.inc.php3');
|
||||
if (isset($message)) {
|
||||
include('./lib.inc.php3');
|
||||
show_message($message);
|
||||
}
|
||||
|
||||
@@ -25,7 +22,7 @@ if (empty($cfgLang)) {
|
||||
$lang_name = ucfirst(substr(strstr($tmplang[0], '|'), 1));
|
||||
echo "\n";
|
||||
?>
|
||||
[ <a href="index.php3?server=<?php echo $server;?>&lang=<?php echo $id;?>" target="_top" title="<?php echo $lang_name;?>"><?php echo $id;?></a> ]
|
||||
[ <a href="index.php3?lang=<?php echo $id; ?>&server=<?php echo urlencode($server); ?>" target="_top" title="<?php echo $lang_name; ?>"><?php echo $id; ?></a> ]
|
||||
<?php
|
||||
}
|
||||
echo "\n<p><br />\n";
|
||||
@@ -35,11 +32,10 @@ if (empty($cfgLang)) {
|
||||
/**
|
||||
* Displays the welcome message and the server informations
|
||||
*/
|
||||
?>
|
||||
<h1><?php echo $strWelcome . ' phpMyAdmin ' . PHPMYADMIN_VERSION; ?></h1>
|
||||
|
||||
echo "<h1>$strWelcome phpMyAdmin ";
|
||||
echo PHPMYADMIN_VERSION;
|
||||
echo "</h1>\n";
|
||||
|
||||
<?php
|
||||
// Don't display server info if $server == 0 (no server selected)
|
||||
if ($server > 0) {
|
||||
$res_version = mysql_query('SELECT Version() as version') or mysql_die();
|
||||
@@ -116,57 +112,58 @@ if ($server == 0 || count($cfgServers) > 1) {
|
||||
if ($server > 0
|
||||
&& empty($cfgServer['only_db']))
|
||||
{
|
||||
$common_url_query = 'lang=' . $lang . '&server=' . urlencode($server);
|
||||
|
||||
// 2.1. With authentication
|
||||
if ($cfgServer['adv_auth'])
|
||||
{
|
||||
// Get user's rights
|
||||
// Get user's rights
|
||||
if (empty($cfgServer['port'])) {
|
||||
$stdlink = mysql_connect($cfgServer['host'], $cfgServer['stduser'], $cfgServer['stdpass']);
|
||||
$stdlink = mysql_connect($cfgServer['host'], $cfgServer['stduser'], $cfgServer['stdpass']);
|
||||
} else {
|
||||
$stdlink = mysql_connect($cfgServer['host'] . ':' . $cfgServer['port'], $cfgServer['stduser'], $cfgServer['stdpass']);
|
||||
$stdlink = mysql_connect($cfgServer['host'] . ':' . $cfgServer['port'], $cfgServer['stduser'], $cfgServer['stdpass']);
|
||||
}
|
||||
// Does user have global Create priv?
|
||||
$rs_usr = mysql_query('select * from mysql.user where User="' . $cfgServer['user'] . '"', $stdlink);
|
||||
$result_usr = mysql_fetch_array($rs_usr);
|
||||
$create = ($result_usr['Create_priv'] == 'Y');
|
||||
$db_to_create = "";
|
||||
// Does user have global Create priv?
|
||||
$rs_usr = mysql_query('SELECT * FROM mysql.user WHERE User = \'' . sql_addslashes($cfgServer['user']) . '\'', $stdlink);
|
||||
$result_usr = mysql_fetch_array($rs_usr);
|
||||
$create = ($result_usr['Create_priv'] == 'Y');
|
||||
$db_to_create = '';
|
||||
|
||||
// Does user have Create priv on a inexistant db?
|
||||
// if yes, show him in the dialog the first inexistant db name
|
||||
// that we find, in most cases it's probably the one he just dropped :)
|
||||
// (Note: we only get here after a browser reload, I don't know why)
|
||||
// Does user have Create priv on a inexistant db?
|
||||
// if yes, show him in the dialog the first inexistant db name that we
|
||||
// find, in most cases it's probably the one he just dropped :)
|
||||
// (Note: we only get here after a browser reload, I don't know why)
|
||||
if (!$create) {
|
||||
|
||||
if (!$create) {
|
||||
|
||||
if (empty($cfgServer['port'])) {
|
||||
$userlink = mysql_connect($cfgServer['host'], $cfgServer['user'], $cfgServer['password']) or mysql_die();
|
||||
if (empty($cfgServer['port'])) {
|
||||
$userlink = mysql_connect($cfgServer['host'], $cfgServer['user'],
|
||||
$cfgServer['password']) or mysql_die();
|
||||
} else {
|
||||
$userlink = mysql_connect($cfgServer['host'].":".
|
||||
$cfgServer['port'], $cfgServer['user'],
|
||||
$cfgServer['port'], $cfgServer['user'],
|
||||
$cfgServer['password']) or mysql_die();
|
||||
}
|
||||
$rs_usr = mysql_query('select Db from mysql.db where User="'
|
||||
. $cfgServer['user'] . '"', $stdlink);
|
||||
while ($row = mysql_fetch_array($rs_usr)) {
|
||||
if (!mysql_select_db($row['Db'],$userlink)) {
|
||||
$db_to_create = $row['Db'];
|
||||
$create=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// The user is allowed the create a db
|
||||
$rs_usr = mysql_query('SELECT Db FROM mysql.db WHERE User = \'' . sql_addslashes($cfgServer['user']) . '\'', $stdlink);
|
||||
while ($row = mysql_fetch_array($rs_usr)) {
|
||||
if (!mysql_select_db($row['Db'],$userlink)) {
|
||||
$db_to_create = $row['Db'];
|
||||
$create = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// The user is allowed to create a db
|
||||
if ($create) {
|
||||
echo "\n";
|
||||
?>
|
||||
<!-- db creation form -->
|
||||
<!-- db creation form -->
|
||||
<li>
|
||||
<form method="post" action="db_create.php3">
|
||||
<?php echo $strCreateNewDatabase . ' ' . show_docu('manual_Reference.html#CREATE_DATABASE'); ?><br />
|
||||
<input type="hidden" name="server" value="<?php echo $server; ?>" />
|
||||
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
|
||||
<input type="hidden" name="reload" value="true" />
|
||||
<input type="text" name="db" value="<?php echo $db_to_create; ?>"/>
|
||||
<input type="text" name="db" value="<?php echo $db_to_create; ?>" />
|
||||
<input type="submit" value="<?php echo $strCreate; ?>" />
|
||||
</form>
|
||||
</li>
|
||||
@@ -179,11 +176,11 @@ if ($server > 0
|
||||
?>
|
||||
<!-- server-related links -->
|
||||
<li>
|
||||
<a href="sql.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW STATUS'); ?>&display=simple">
|
||||
<a href="sql.php3?<?php echo $common_url_query; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW STATUS'); ?>&display=simple">
|
||||
<?php echo $strMySQLShowStatus; ?></a> <?php echo show_docu('manual_Reference.html#SHOW') . "\n"; ?>
|
||||
</li>
|
||||
<li>
|
||||
<a href="sql.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW VARIABLES'); ?>&display=simple">
|
||||
<a href="sql.php3?<?php $common_url_query; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW VARIABLES'); ?>&display=simple">
|
||||
<?php echo $strMySQLShowVars;?></a> <?php echo show_docu('manual_Performance.html#Performance') . "\n"; ?>
|
||||
</li>
|
||||
<?php
|
||||
@@ -193,21 +190,21 @@ if ($server > 0
|
||||
if ($result_usr['Process_priv'] == 'Y') {
|
||||
?>
|
||||
<li>
|
||||
<a href="sql.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW PROCESSLIST'); ?>&display=simple">
|
||||
<a href="sql.php3?<?php echo $common_url_query; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW PROCESSLIST'); ?>&display=simple">
|
||||
<?php echo $strMySQLShowProcess; ?></a> <?php echo show_docu('manual_Reference.html#SHOW') . "\n"; ?>
|
||||
</li>
|
||||
<?php
|
||||
echo "\n";
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
if ($result_usr['Reload_priv'] == 'Y') {
|
||||
?>
|
||||
<li>
|
||||
<a href="main.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&mode=reload">
|
||||
<a href="main.php3?<?php echo $common_url_query; ?>&mode=reload">
|
||||
<?php echo $strReloadMySQL; ?></a> <?php echo show_docu('manual_Reference.html#FLUSH') . "\n"; ?>
|
||||
</li>
|
||||
<?php
|
||||
echo "\n";
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
$result = mysql_query('SELECT * FROM mysql.user');
|
||||
@@ -215,7 +212,7 @@ if ($server > 0
|
||||
if (!empty($rows)) {
|
||||
?>
|
||||
<li>
|
||||
<a href="user_details.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=mysql&table=user">
|
||||
<a href="user_details.php3?<?php echo $common_url_query; ?>&db=mysql&table=user">
|
||||
<?php echo $strUsers; ?></a> <?php echo show_docu('manual_Privilege_system.html#Privilege_system') . "\n"; ?>
|
||||
</li>
|
||||
<?php
|
||||
@@ -223,19 +220,19 @@ if ($server > 0
|
||||
}
|
||||
?>
|
||||
<li>
|
||||
<a href="index.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&old_usr=<?php echo $PHP_AUTH_USER; ?>" target="_top">
|
||||
<a href="index.php3?<?php echo$common_url_query; ?>&old_usr=<?php echo urlencode($PHP_AUTH_USER); ?>" target="_top">
|
||||
<b><?php echo $strLogout; ?></b></a>
|
||||
</li>
|
||||
<br /><br />
|
||||
<?php
|
||||
echo "\n";
|
||||
} // end of 2.1 (AdvAuth case)
|
||||
|
||||
|
||||
// 2.2. No authentification
|
||||
else
|
||||
{
|
||||
?>
|
||||
<!-- db creation form -->
|
||||
<!-- db creation form -->
|
||||
<li>
|
||||
<form method="post" action="db_create.php3">
|
||||
<?php echo $strCreateNewDatabase . ' ' . show_docu('manual_Reference.html#CREATE_DATABASE'); ?><br />
|
||||
@@ -246,25 +243,25 @@ if ($server > 0
|
||||
<input type="submit" value="<?php echo $strCreate; ?>" />
|
||||
</form>
|
||||
</li>
|
||||
|
||||
|
||||
<!-- server-related links -->
|
||||
<li>
|
||||
<a href="sql.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW STATUS'); ?>">
|
||||
<a href="sql.php3?<?php echo $common_url_query; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW STATUS'); ?>">
|
||||
<?php echo $strMySQLShowStatus; ?></a> <?php echo show_docu('manual_Reference.html#SHOW') . "\n"; ?>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<a href="sql.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW VARIABLES'); ?>">
|
||||
<a href="sql.php3?<?php echo $common_url_query; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW VARIABLES'); ?>">
|
||||
<?php echo $strMySQLShowVars; ?></a> <?php echo show_docu('manual_Performance.html#Performance') . "\n"; ?>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<a href="sql.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW PROCESSLIST'); ?>">
|
||||
<a href="sql.php3?<?php echo $common_url_query; ?>&db=mysql&sql_query=<?php echo urlencode('SHOW PROCESSLIST'); ?>">
|
||||
<?php echo $strMySQLShowProcess; ?></a> <?php echo show_docu('manual_Reference.html#SHOW') . "\n"; ?>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<a href="main.php3?server=<?php echo $server; ?>&lang=<?php echo $lang; ?>&mode=reload">
|
||||
<a href="main.php3?<?php echo $common_url_query; ?>&mode=reload">
|
||||
<?php echo $strReloadMySQL; ?></a> <?php echo show_docu('manual_Reference.html#FLUSH') . "\n"; ?>
|
||||
</li>
|
||||
<br /><br />
|
||||
@@ -290,7 +287,7 @@ if ($server > 0
|
||||
<?php
|
||||
/**
|
||||
* Displays the footer
|
||||
* TODO: The included script aren't yet xhtml1.0 compliant
|
||||
*/
|
||||
echo "\n";
|
||||
require('./footer.inc.php3');
|
||||
?>
|
||||
|
Reference in New Issue
Block a user