diff --git a/main.php3 b/main.php3
index bfa18e4ef..def2e403c 100755
--- a/main.php3
+++ b/main.php3
@@ -2,19 +2,22 @@
/* $Id$ */
-require("./grab_globals.inc.php3");
-
-if (!isset($message)) {
- include("./header.inc.php3");
-} else {
- include("./header.inc.php3");
- include("./lib.inc.php3");
- show_message($message);
+/**
+ * Gets some core libraries and diplays 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);
}
-?>
-';
reset($available_languages);
@@ -27,172 +30,243 @@ if (empty($cfgLang)) {
}
echo "\n
\n";
}
+
+
+/**
+ * Displays the welcome message and the server informations
+ */
?>
-
-
phpMyAdmin 2.3.0alpha-20010604 (unofficial devel-branch)
0) {
- // Don't display server info if $server==0 (no server selected)
- $res_version = mysql_query("SELECT Version() as version") or mysql_die();
- $row_version = mysql_fetch_array($res_version);
-
- echo "MySQL $row_version[version] $strRunning " . $cfgServer['host'];
- if (!empty($cfgServer['port'])) {
- echo ":" . $cfgServer['port'];
- }
- echo "
\n";
+ $res_version = mysql_query('SELECT Version() as version') or mysql_die();
+ $row_version = mysql_fetch_array($res_version);
+ echo 'MySQL ' . $row_version['version'] . ' ' . $strRunning . ' ' . $cfgServer['host'];
+ if (!empty($cfgServer['port'])) {
+ echo ':' . $cfgServer['port'];
+ }
+ echo "
\n";
}
-?>
-
- 0) && isset($mode) && ($mode == "reload"))
- {
- $result = mysql_query("FLUSH PRIVILEGES");
- if ($result != 0) {
- echo "
$strMySQLReloaded";
- } else {
- echo "
$strReloadFailed";
- }
- }
+
+/**
+ * Reload mysql (flush privileges)
+ */
+if (($server > 0) && isset($mode) && ($mode == 'reload')) {
+ $result = mysql_query('FLUSH PRIVILEGES');
+ echo '
';
+ if ($result != 0) {
+ echo $strMySQLReloaded;
+ } else {
+ echo $strReloadFailed;
+ }
+ echo '
' . "\n";
+}
+
+
+
+/**
+ * Displays the servers choice form and/or the server-related links
+ */
?>
1)
+// 1. The servers choice form
+if (count($cfgServers) > 1)
{
- echo "- ";
- echo '';
-}
-
-if($server > 0) {
- // Don't display server-related links if $server==0 (no server selected)
- if(empty($cfgServer['only_db'])) {
- if($cfgServer['adv_auth'])
- {
- if (empty($cfgServer['port'])) {
- $dbh = mysql_connect($cfgServer['host'],$cfgServer['stduser'],$cfgServer['stdpass']);
- } else {
- $dbh = mysql_connect($cfgServer['host'].":".$cfgServer['port'],$cfgServer['stduser'],$cfgServer['stdpass']);
- }
-
- $rs_usr=mysql_query("select * from mysql.user where User=\"".$cfgServer['user']."\"",$dbh);
- $result_usr=mysql_fetch_array($rs_usr);
- $rs_db=mysql_query("select * from mysql.db where User=\"".$cfgServer['user']."\"",$dbh);
-
- if(mysql_num_rows($rs_db)>0) {
- $result_db=mysql_fetch_array($rs_db);
- }
-
- if($result_usr['Create_priv']=='Y') {
- $CREATE=TRUE;
-// BEGIN
-// 2001-05-04, Lem9: The create_priv on a single database does not allow
-// to create a database
-// } elseif(!empty($result_db) && $result_db['Create_priv']=='Y') {
-// $CREATE=TRUE;
-// END
- } else {
- $CREATE=FALSE;
- }
-
- if($CREATE) {
- ?>
-
-
-
-
-
- &display=simple">
-
-
-
- &display=simple">
-
-
- &display=simple">
-
-
-
-
-";
- echo "$strUsers ";
- print show_docu("manual_Privilege_system.html#Privilege_system");
-}
-?>
-
-
-
-
-
-
-
- ">
-
-
- ">
-
-
- ">
-
-
-
-
-
+ -
+
+
+ 0 (a server selected)
+if ($server > 0
+ && empty($cfgServer['only_db']))
+{
+ // 2.1. With authentification
+ if ($cfgServer['adv_auth'])
+ {
+ // Get user's rights
+ if (empty($cfgServer['port'])) {
+ $dbh = mysql_connect($cfgServer['host'], $cfgServer['stduser'], $cfgServer['stdpass']);
+ } else {
+ $dbh = mysql_connect($cfgServer['host'] . ':' . $cfgServer['port'], $cfgServer['stduser'], $cfgServer['stdpass']);
+ }
+ $rs_usr = mysql_query('select * from mysql.user where User="' . $cfgServer['user'] . '"', $dbh);
+ $result_usr = mysql_fetch_array($rs_usr);
+ $create = ($result_usr['Create_priv'] == 'Y');
+
+ // The user is allowed the create a db
+ if ($create) {
+ echo "\n";
+ ?>
+
+ -
+
+
+
+
+ -
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ 0)
?>
--
- (sourceforge)
- [ ChangeLog ]
-
-
-
-
-
-phpMyAdmin
+
+
-
+
+ (SourceForge) [ ChangeLog ]
+
+ -
+
+
+ -
+ phpMyAdmin
+
-
+
+