home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 August / PCWorld_2001-08_cd.bin / Komunikace / phptriad / phptriadsetup2-11.exe / htdocs / phpMyAdmin / main.php < prev    next >
PHP Script  |  2000-08-20  |  6KB  |  184 lines

  1. <?php
  2. /* $Id: main.php,v 1.35 2000/07/31 13:17:27 tobias Exp $ */
  3.  
  4. if (!isset($message))
  5.    {
  6.    include("header.inc.php");
  7.    }
  8. else
  9.    {
  10.    show_message($message);
  11.    }
  12. ?>
  13.  
  14. <h1><?php echo $strWelcome ?> phpMyAdmin 2.1.0</h1>
  15. <?php
  16. if ($server > 0) {
  17.   // Don't display server info if $server==0 (no server selected)
  18. $res_version = mysql_query("SELECT Version() as version") or mysql_die();
  19. $row_version = mysql_fetch_array($res_version);
  20.  
  21. echo "<b>MySQL $row_version[version] $strRunning " . $cfgServer['host'];
  22. if (!empty($cfgServer['port'])) {
  23.   echo ":" . $cfgServer['port'];
  24. }
  25. echo "</b><br>\n";
  26. }
  27. ?>
  28. <div align="left">
  29. <?php
  30.  
  31. if (($server > 0) && isset($mode) && ($mode == "reload"))
  32.    {
  33.      $result = mysql_query("FLUSH PRIVILEGES");
  34.      if ($result != 0) {
  35.        echo "<b>$strMySQLReloaded</b>";
  36.      } else {
  37.        echo "<b>$strReloadFailed</b>";
  38.      }
  39.    }
  40. ?>
  41. <ul>
  42. <?php
  43. if(count($cfgServers) > 1)
  44. {
  45.     echo "<li>";
  46.     echo '<form action="index.php" target="_top"><select name="server">';
  47.  
  48.     reset($cfgServers);
  49.     while(list($key, $val) = each($cfgServers))
  50.     {
  51.         if(!empty($val['host']))
  52.         {
  53.             echo "<option value=\"$key\"";
  54.             if(!empty($server) && ($server == $key))
  55.             {
  56.                 echo " selected";
  57.             }
  58.             echo ">";
  59.             print(!empty($val['verbose']) ? $val['verbose'] :  $val['host']);
  60.  
  61.             if(!empty($val['port']))
  62.             {
  63.                 echo ":" . $val['port'];
  64.             }
  65.             if(!empty($val['only_db']))
  66.                 echo " - ".$val['only_db'];
  67.             echo "\n";
  68.         }
  69.     }
  70.     echo '</select><input type="submit" value="'.$strGo.'"></form>';
  71. }
  72.  
  73. if($server > 0)
  74. {
  75.     // Don't display server-related links if $server==0 (no server selected)
  76.     if(empty($cfgServer['only_db']))
  77.     {
  78.         if($cfgServer['adv_auth'])
  79.         {
  80.             if (empty($cfgServer['port']))
  81.             {
  82.                 $dbh = mysql_connect($cfgServer['host'],$cfgServer['stduser'],$cfgServer['stdpass']);
  83.             }
  84.             else
  85.             {
  86.                 $dbh = mysql_connect($cfgServer['host'].":".$cfgServer['port'],$cfgServer['stduser'],$cfgServer['stdpass']);
  87.             }
  88.  
  89.             $rs_usr=mysql_db_query("mysql","select * from user where User=\"".$cfgServer['user']."\"",$dbh);
  90.             $result_usr=mysql_fetch_array($rs_usr);
  91.             $rs_db=mysql_db_query("mysql","select * from db where User=\"".$cfgServer['user']."\"",$dbh);
  92.  
  93.             if(mysql_num_rows($rs_db)>0)
  94.             {
  95.                     $result_db=mysql_fetch_array($rs_db);
  96.             }
  97.  
  98.             if($result_usr['Create_priv']=='Y')
  99.             {
  100.                 $CREATE=TRUE;
  101.             }
  102.             elseif(!empty($result_db) && $result_db['Create_priv']=='Y')
  103.             {
  104.                 $CREATE=TRUE;
  105.             }
  106.             else
  107.             {
  108.                 $CREATE=FALSE;
  109.             }
  110.  
  111.             if($CREATE)
  112.             {
  113.                 ?>
  114.                 <li>
  115.                 <form method="post" action="db_create.php">
  116.                 <?php echo $strCreateNewDatabase;?> <?php print show_docu("manual_Reference.html#Create_database");?><br><input type="Hidden" name="server" value="<?php echo $server; ?>"><input type="hidden" name="reload" value="true"><input type="text" name="db"><input type="submit" value="<?php echo $strCreate; ?>">
  117.                 </form>
  118.                 <?php
  119.             }
  120.  
  121.             if($result_usr['References_priv']=='Y')
  122.             {
  123.                 ?>
  124.                 <li><a href="sql.php?server=<?php echo $server;?>&db=mysql&sql_query=<?php echo urlencode("SHOW STATUS");?>">
  125.                 <?php echo $strMySQLShowStatus;?></a> <?php print show_docu("manual_Reference.html#Show");?>
  126.  
  127.                 <li><a href="sql.php?server=<?php echo $server;?>&db=mysql&sql_query=<?php echo urlencode("SHOW VARIABLES");?>">
  128.                 <?php echo $strMySQLShowVars;?></a> <?php print show_docu("manual_Performance.html#Performance");
  129.             }
  130.  
  131.             if($result_usr['Process_priv']=='Y')
  132.             {
  133.                 ?>
  134.                 <li><a href="sql.php?server=<?php echo $server;?>&db=mysql&sql_query=<?php echo urlencode("SHOW PROCESSLIST");?>">
  135.                 <?php echo $strMySQLShowProcess;?></a> <?php print show_docu("manual_Reference.html#Show");
  136.             }
  137.  
  138.             if($result_usr['Reload_priv']=='Y')
  139.             {
  140.                 ?>
  141.                 <li>
  142.                 <a href="main.php?server=<?php echo $server;?>&mode=reload"><?php echo $strReloadMySQL; ?></a> <?php print show_docu("manual_Reference.html#Flush");
  143.             }
  144.             ?>
  145.             <li><a href="index.php?server=<?php echo $server;?>&old_usr=<?php echo $PHP_AUTH_USER;?>" target="_top"><?php echo $strLogout; ?></a>
  146.             <?php
  147.         }
  148.         else
  149.         { //No AdvAuth
  150.             ?>
  151.             <li>
  152.             <form method="post" action="db_create.php">
  153.             <?php echo $strCreateNewDatabase;?> <?php print show_docu("manual_Reference.html#Create_database");?><br><input type="Hidden" name="server" value="<?php echo $server; ?>"><input type="hidden" name="reload" value="true"><input type="text" name="db"><input type="submit" value="<?php echo $strCreate; ?>">
  154.             </form>
  155.             <li><a href="sql.php?server=<?php echo $server;?>&db=mysql&sql_query=<?php echo urlencode("SHOW STATUS");?>">
  156.             <?php echo $strMySQLShowStatus;?></a> <?php print show_docu("manual_Reference.html#Show");?>
  157.             <li><a href="sql.php?server=<?php echo $server;?>&db=mysql&sql_query=<?php echo urlencode("SHOW VARIABLES");?>">
  158.             <?php echo $strMySQLShowVars;?></a> <?php print show_docu("manual_Performance.html#Performance");?>
  159.             <li><a href="sql.php?server=<?php echo $server;?>&db=mysql&sql_query=<?php echo urlencode("SHOW PROCESSLIST");?>">
  160.             <?php echo $strMySQLShowProcess;?></a> <?php print show_docu("manual_Reference.html#Show");?>
  161.             <li>
  162.             <a href="main.php?server=<?php echo $server;?>&mode=reload"><?php echo $strReloadMySQL; ?></a> <?php print show_docu("manual_Reference.html#Flush");
  163.         }
  164.     }
  165. }
  166. ?>
  167.  
  168. <li>
  169. <a href="http://phpwizard.net/projects/phpMyAdmin/" target="_top">phpMyAdmin-Homepage</a>
  170. <li>
  171. <a href="Documentation.html" target="_top">phpMyAdmin <?php print $strDocu;?></a>
  172. </ul>
  173. <?php
  174. if(!get_magic_quotes_gpc())
  175. {
  176.     print($strEnableMagicQuotes);
  177. }
  178. ?>
  179.  
  180. </div>
  181.  
  182. <?php
  183. require ("footer.inc.php");
  184. ?>