00001 <?php
00002
00003
00004
00008 define('PMA_DISPLAY_HEADING', 0);
00009
00013 require_once('./libraries/grab_globals.lib.php');
00014 require_once('./libraries/common.lib.php');
00015
00016 if (!isset($pma_uri_parts)) {
00017 $pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);
00018 $cookie_path = substr($pma_uri_parts['path'], 0, strrpos($pma_uri_parts['path'], '/'));
00019 $is_https = (isset($pma_uri_parts['scheme']) && $pma_uri_parts['scheme'] == 'https') ? 1 : 0;
00020 }
00021 setcookie('lang', $lang, time() + 60*60*24*30, $cookie_path, '', $is_https);
00022
00023 $item_img = 'images/item_' . $text_dir . '.png';
00024
00025 if (isset($db)) {
00026 unset($db);
00027 }
00028 if (isset($table)) {
00029 unset($table);
00030 }
00031 $show_query = '1';
00032 require_once('./header.inc.php');
00033 if (isset($message)) {
00034 PMA_showMessage($message);
00035 }
00036 else if (isset($reload) && $reload) {
00037
00038 echo "\n";
00039 ?>
00040 <script type="text/javascript" language="javascript1.2">
00041 <!--
00042 window.parent.frames['nav'].location.replace('./left.php?<?php echo PMA_generate_common_url('', '', '&');?>&hash=' + <?php echo (($cfg['QueryFrame'] && $cfg['QueryFrameJS']) ? 'window.parent.frames[\'queryframe\'].document.hashform.hash.value' : "'" . md5($cfg['PmaAbsoluteUri']) . "'"); ?>););
00043
00044 </script>
00045 <?php
00046 }
00047 echo "\n";
00048
00049
00053 ?>
00054 <h1><?php echo sprintf($strWelcome, ' phpMyAdmin ' . PMA_VERSION); ?></h1>
00055
00056 <?php
00057
00058
00059
00060 if ($server > 0) {
00061
00062
00063 if(!empty($cfg['Server']['verbose'])) {
00064 $server_info = $cfg['Server']['verbose'];
00065 } else {
00066 $server_info = $cfg['Server']['host'];
00067 }
00068 $server_info .= (empty($cfg['Server']['port']) ? '' : ':' . $cfg['Server']['port']);
00069
00070
00071
00072
00073
00074 $local_query = 'SELECT VERSION() as version, USER() as user';
00075 $res = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, FALSE, '');
00076 $mysql_cur_user_and_host = PMA_mysql_result($res, 0, 'user');
00077 $mysql_cur_user = substr($mysql_cur_user_and_host, 0, strrpos($mysql_cur_user_and_host, '@'));
00078
00079 $full_string = str_replace('%pma_s1%', PMA_mysql_result($res, 0, 'version'), $strMySQLServerProcess);
00080 $full_string = str_replace('%pma_s2%', $server_info, $full_string);
00081 $full_string = str_replace('%pma_s3%', $mysql_cur_user_and_host, $full_string);
00082
00083 echo '<p><b>' . $full_string . '</b></p><br />' . "\n";
00084 }
00085
00086
00090 if (($server > 0) && isset($mode) && ($mode == 'reload')) {
00091 $result = PMA_mysql_query('FLUSH PRIVILEGES');
00092 echo '<p><b>';
00093 if ($result != 0) {
00094 echo $strMySQLReloaded;
00095 } else {
00096 echo $strReloadFailed;
00097 }
00098 echo '</b></p>' . "\n\n";
00099 }
00100
00101
00105 if ($server == 0 || count($cfg['Servers']) > 1) {
00106 ?>
00107 <!-- MySQL servers choice form -->
00108 <table>
00109 <tr>
00110 <th><?php echo $strServerChoice; ?></th>
00111 </tr>
00112 <tr>
00113 <td>
00114 <form method="post" action="index.php" target="_parent">
00115 <select name="server">
00116 <?php
00117 echo "\n";
00118 foreach($cfg['Servers'] AS $key => $val) {
00119 if (!empty($val['host'])) {
00120 echo ' <option value="' . $key . '"';
00121 if (!empty($server) && ($server == $key)) {
00122 echo ' selected="selected"';
00123 }
00124 echo '>';
00125 if (!empty($val['verbose'])) {
00126 echo $val['verbose'];
00127 } else {
00128 echo $val['host'];
00129 if (!empty($val['port'])) {
00130 echo ':' . $val['port'];
00131 }
00132 }
00133
00134
00135
00136 if (!empty($val['only_db'])) {
00137 echo ' - ' . (is_array($val['only_db']) ? implode(', ', $val['only_db']) : $val['only_db']);
00138 }
00139 if (!empty($val['user']) && ($val['auth_type'] == 'config')) {
00140 echo ' (' . $val['user'] . ')';
00141 }
00142 echo ' </option>' . "\n";
00143 }
00144 }
00145 ?>
00146 </select>
00147 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
00148 <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
00149 <input type="submit" value="<?php echo $strGo; ?>" />
00150 </form>
00151 </td>
00152 </tr>
00153 </table>
00154 <br />
00155 <?php
00156 }
00157 ?>
00158
00159 <!-- MySQL and phpMyAdmin related links -->
00160 <table>
00161 <tr>
00162
00163 <?php
00167 $is_superuser = FALSE;
00168 if ($server > 0) {
00169
00170
00171
00172
00173 $is_create_priv = FALSE;
00174 $is_process_priv = TRUE;
00175 $is_reload_priv = FALSE;
00176
00177
00178
00179
00180 $is_superuser = @PMA_mysql_query('SELECT COUNT(*) FROM mysql.user', $userlink);
00181 if ($dbh) {
00182 $local_query = 'SELECT Create_priv, Process_priv, Reload_priv FROM mysql.user WHERE User = \'' . PMA_sqlAddslashes($mysql_cur_user) . '\'';
00183 $rs_usr = PMA_mysql_query($local_query, $dbh);
00184 if ($rs_usr) {
00185 while ($result_usr = PMA_mysql_fetch_array($rs_usr)) {
00186 if (!$is_create_priv) {
00187 $is_create_priv = ($result_usr['Create_priv'] == 'Y');
00188 }
00189
00190
00191
00192
00193
00194
00195 if (!$is_reload_priv) {
00196 $is_reload_priv = ($result_usr['Reload_priv'] == 'Y');
00197 }
00198 }
00199 mysql_free_result($rs_usr);
00200 }
00201 }
00202
00203
00204
00205 if (!$is_create_priv) {
00206 $local_query = 'SELECT DISTINCT Db FROM mysql.db WHERE Create_priv = \'Y\' AND User = \'' . PMA_sqlAddslashes($mysql_cur_user) . '\'';
00207 $rs_usr = PMA_mysql_query($local_query, $dbh);
00208 if ($rs_usr) {
00209 $re0 = '(^|(\\\\\\\\)+|[^\])';
00210 $re1 = '(^|[^\])(\\\)+';
00211 while ($row = PMA_mysql_fetch_array($rs_usr)) {
00212 if (ereg($re0 . '(%|_)', $row['Db'])
00213 || (!PMA_mysql_select_db(ereg_replace($re1 . '(%|_)', '\\1\\3', $row['Db']), $userlink) && @mysql_errno() != 1044)) {
00214 $db_to_create = ereg_replace($re0 . '%', '\\1...', ereg_replace($re0 . '_', '\\1?', $row['Db']));
00215 $db_to_create = ereg_replace($re1 . '(%|_)', '\\1\\3', $db_to_create);
00216 $is_create_priv = TRUE;
00217 break;
00218 }
00219 }
00220 mysql_free_result($rs_usr);
00221 }
00222 else {
00223
00224
00225
00226 $local_query = 'SHOW GRANTS FOR ' . $mysql_cur_user_and_host;
00227 $rs_usr = PMA_mysql_query($local_query, $dbh);
00228 if (!$rs_usr) {
00229
00230
00231 $local_query = 'SHOW GRANTS FOR ' . $mysql_cur_user;
00232 $rs_usr = PMA_mysql_query($local_query, $dbh);
00233 }
00234 if ($rs_usr) {
00235 $re0 = '(^|(\\\\\\\\)+|[^\])';
00236 $re1 = '(^|[^\])(\\\)+';
00237 while ($row = PMA_mysql_fetch_row($rs_usr)) {
00238 $show_grants_dbname = substr($row[0], strpos($row[0], ' ON ') + 4,(strpos($row[0], '.', strpos($row[0], ' ON ')) - strpos($row[0], ' ON ') - 4));
00239 $show_grants_str = substr($row[0],6,(strpos($row[0],' ON ')-6));
00240 if (($show_grants_str == 'ALL') || ($show_grants_str == 'ALL PRIVILEGES') || ($show_grants_str == 'CREATE') || strpos($show_grants_str, 'CREATE')) {
00241 if ($show_grants_dbname == '*') {
00242 $is_create_priv = TRUE;
00243 $db_to_create = '';
00244 break;
00245 }
00246 else if (ereg($re0 . '%|_', $show_grants_dbname) || !PMA_mysql_select_db($show_grants_dbname, $userlink) && @mysql_errno() != 1044) {
00247 $db_to_create = ereg_replace($re0 . '%', '\\1...', ereg_replace($re0 . '_', '\\1?', $show_grants_dbname));
00248 $db_to_create = ereg_replace($re1 . '(%|_)', '\\1\\3', $db_to_create);
00249
00250 $db_to_create = str_replace('`','',$db_to_create);
00251 $is_create_priv = TRUE;
00252 break;
00253 }
00254 }
00255 }
00256 unset($show_grants_dbname, $show_grants_str);
00257 mysql_free_result($rs_usr);
00258 }
00259 }
00260 }
00261 else {
00262 $db_to_create = '';
00263 }
00264
00265 if (!$cfg['SuggestDBName']) {
00266 $db_to_create = '';
00267 }
00268
00269 $common_url_query = PMA_generate_common_url();
00270
00271 if ($is_superuser) {
00272 $cfg['ShowMysqlInfo'] = TRUE;
00273 $cfg['ShowMysqlVars'] = TRUE;
00274 $cfg['ShowChgPassword'] = TRUE;
00275 }
00276 if ($cfg['Server']['auth_type'] == 'config') {
00277 $cfg['ShowChgPassword'] = FALSE;
00278 }
00279
00280
00281
00282 if ($is_superuser || $is_create_priv || $is_process_priv || $is_reload_priv
00283 || $cfg['ShowMysqlInfo'] || $cfg['ShowMysqlVars'] || $cfg['ShowChgPassword']
00284 || $cfg['Server']['auth_type'] != 'config') {
00285 ?>
00286 <!-- MySQL server related links -->
00287 <td valign="top" align="<?php echo $cell_align_left; ?>">
00288 <table>
00289 <tr>
00290 <th colspan="2"> MySQL</th>
00291 </tr>
00292 <?php
00293
00294 if ($is_create_priv) {
00295 echo "\n"
00296 . ' <!-- db creation form -->' . "\n"
00297 . ' <tr>' . "\n"
00298 . ' <td valign="baseline"><img src="' . $item_img . '" width="7" height="7" alt="item" /></td>' . "\n"
00299 . ' <td>' . "\n"
00300 . ' <form method="post" action="db_create.php">' . "\n"
00301 . ' ' . $strCreateNewDatabase . ' ' . PMA_showMySQLDocu('Reference', 'CREATE_DATABASE') . "\n"
00302 . '<br />' . "\n"
00303 . PMA_generate_common_hidden_inputs(5)
00304 . ' <input type="hidden" name="reload" value="1" />' . "\n"
00305 . ' <input type="text" name="db" value="' . $db_to_create . '" maxlength="64" class="textfield" />' . "\n";
00306
00307 if (PMA_MYSQL_INT_VERSION >= 40101) {
00308 require_once('./libraries/mysql_charsets.lib.php');
00309 echo ' <select name="db_charset">' . "\n"
00310 . ' <option value="">' . $strCharset . '</option>' . "\n"
00311 . ' <option value=""></option>' . "\n";
00312 for ($i = 0; isset($mysql_charsets[$i]); $i++) {
00313 echo ' <option value="' . htmlspecialchars($mysql_charsets[$i]) . '">' . htmlspecialchars($mysql_charsets[$i]) . '</option>' . "\n";
00314 }
00315 echo ' </select>' . "\n";
00316 }
00317 echo ' <input type="submit" value="' . $strCreate . '" />' . "\n"
00318 . ' </form>' . "\n"
00319 . ' </td>' . "\n"
00320 . ' </tr>' . "\n";
00321 } else {
00322 echo "\n";
00323 ?>
00324 <!-- db creation no privileges message -->
00325 <tr>
00326 <td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
00327 <td>
00328 <?php echo $strCreateNewDatabase . ': ' . PMA_showMySQLDocu('Reference', 'CREATE_DATABASE'); ?><br />
00329 <?php echo '<i>' . $strNoPrivileges .'</i>'; ?><br />
00330 </td>
00331 </tr>
00332 <?php
00333 }
00334 echo "\n";
00335
00336
00337 ?>
00338 <!-- server-related links -->
00339 <?php
00340 if ($cfg['ShowMysqlInfo']) {
00341 echo "\n";
00342 ?>
00343 <tr>
00344 <td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
00345 <td>
00346 <a href="./server_status.php?<?php echo $common_url_query; ?>">
00347 <?php echo $strMySQLShowStatus . "\n"; ?>
00348 </a>
00349 </td>
00350 </tr>
00351 <?php
00352 }
00353 if ($cfg['ShowMysqlVars']) {
00354 echo "\n";
00355 ?>
00356 <tr>
00357 <td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
00358 <td>
00359 <a href="./server_variables.php?<?php echo $common_url_query; ?>">
00360 <?php echo $strMySQLShowVars;?></a>
00361 <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'SHOW_VARIABLES') . "\n"; ?>
00362 </td>
00363 </tr>
00364 <?php
00365 }
00366
00367 echo "\n";
00368 ?>
00369 <tr>
00370 <td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
00371 <td>
00372 <a href="./server_processlist.php?<?php echo $common_url_query; ?>">
00373 <?php echo $strMySQLShowProcess; ?></a>
00374 <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'SHOW_PROCESSLIST') . "\n"; ?>
00375 </td>
00376 </tr>
00377 <?php
00378
00379 if (PMA_MYSQL_INT_VERSION >= 40100) {
00380 echo "\n";
00381 ?>
00382 <tr>
00383 <td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
00384 <td>
00385 <a href="./server_collations.php?<?php echo $common_url_query; ?>">
00386 <?php echo $strCharsetsAndCollations; ?></a>
00387 </td>
00388 </tr>
00389 <?php
00390 }
00391
00392 if ($is_reload_priv) {
00393 echo "\n";
00394 ?>
00395 <tr>
00396 <td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
00397 <td>
00398 <a href="main.php?<?php echo $common_url_query; ?>&mode=reload">
00399 <?php echo $strReloadMySQL; ?></a>
00400 <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'FLUSH') . "\n"; ?>
00401 </td>
00402 </tr>
00403 <?php
00404 }
00405
00406 if ($is_superuser) {
00407 echo "\n";
00408 ?>
00409 <tr>
00410 <td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
00411 <td>
00412 <a href="server_privileges.php?<?php echo $common_url_query; ?>">
00413 <?php echo $strPrivileges; ?></a>
00414 </td>
00415 </tr>
00416 <?php
00417 }
00418 ?>
00419 <tr>
00420 <td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
00421 <td>
00422 <a href="./server_databases.php?<?php echo $common_url_query; ?>">
00423 <?php echo $strDatabases; ?></a>
00424 </td>
00425 </tr>
00426 <tr>
00427 <td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
00428 <td>
00429 <a href="./server_export.php?<?php echo $common_url_query; ?>">
00430 <?php echo $strExport; ?></a>
00431 </td>
00432 </tr>
00433 <?php
00434
00435
00436 if ($cfg['ShowChgPassword']) {
00437 echo "\n";
00438 ?>
00439 <tr>
00440 <td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
00441 <td>
00442 <a href="user_password.php?<?php echo $common_url_query; ?>">
00443 <?php echo ($strChangePassword); ?></a>
00444 </td>
00445 </tr>
00446 <?php
00447 }
00448
00449
00450 if ($cfg['Server']['auth_type'] != 'config') {
00451 $http_logout = ($cfg['Server']['auth_type'] == 'http')
00452 ? "\n" . ' <a href="./Documentation.html#login_bug" target="documentation">(*)</a>'
00453 : '';
00454 echo "\n";
00455 ?>
00456 <tr>
00457 <td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
00458 <td>
00459 <a href="index.php?<?php echo $common_url_query; ?>&old_usr=<?php echo urlencode($PHP_AUTH_USER); ?>" target="_parent">
00460 <b><?php echo $strLogout; ?></b></a> <?php echo $http_logout . "\n"; ?>
00461 </td>
00462 </tr>
00463 <?php
00464 }
00465 echo "\n";
00466 ?>
00467 </table>
00468 </td>
00469
00470 <td> </td>
00471 <?php
00472 }
00473 }
00474 echo "\n";
00475
00476
00480 ?>
00481
00482 <!-- phpMyAdmin related links -->
00483 <td valign="top" align="<?php echo $cell_align_left; ?>">
00484 <table>
00485 <tr>
00486 <th colspan="2"> phpMyAdmin</th>
00487 </tr>
00488
00489 <?php
00490
00491 if (empty($cfg['Lang'])) {
00492 ?>
00493 <!-- Language Selection -->
00494 <tr>
00495 <td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
00496 <td nowrap="nowrap">
00497 <form method="post" action="index.php" target="_parent">
00498 <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
00499 <input type="hidden" name="server" value="<?php echo $server; ?>" />
00500 Language <a href="./translators.html" target="documentation">(*)</a>:
00501 <select name="lang" dir="ltr" onchange="this.form.submit();">
00502 <?php
00503 echo "\n";
00504
00515 function PMA_cmp(&$a, $b)
00516 {
00517 return (strcmp($a[1], $b[1]));
00518 }
00519
00520 uasort($available_languages, 'PMA_cmp');
00521 foreach($available_languages AS $id => $tmplang) {
00522 $lang_name = ucfirst(substr(strstr($tmplang[0], '|'), 1));
00523 if ($lang == $id) {
00524 $selected = ' selected="selected"';
00525 } else {
00526 $selected = '';
00527 }
00528 echo ' ';
00529 echo '<option value="' . $id . '"' . $selected . '>' . $lang_name . ' (' . $id . ')</option>' . "\n";
00530 }
00531 ?>
00532 </select>
00533 <noscript><input type="submit" value="Go" /></noscript>
00534 </form>
00535 </td>
00536 </tr>
00537 <?php
00538 }
00539
00540 if (isset($cfg['AllowAnywhereRecoding']) && $cfg['AllowAnywhereRecoding']
00541 && $allow_recoding) {
00542 echo "\n";
00543 ?>
00544 <!-- Charset Selection -->
00545 <tr>
00546 <td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
00547 <td nowrap="nowrap">
00548 <form method="post" action="index.php" target="_parent">
00549 <input type="hidden" name="server" value="<?php echo $server; ?>" />
00550 <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
00551 <?php echo $strMySQLCharset;?>:
00552 <select name="convcharset" dir="ltr" onchange="this.form.submit();">
00553 <?php
00554 echo "\n";
00555 foreach($cfg['AvailableCharsets'] AS $id => $tmpcharset) {
00556 if ($convcharset == $tmpcharset) {
00557 $selected = ' selected="selected"';
00558 } else {
00559 $selected = '';
00560 }
00561 echo ' '
00562 . '<option value="' . $tmpcharset . '"' . $selected . '>' . $tmpcharset . '</option>' . "\n";
00563 }
00564 ?>
00565 </select>
00566 <noscript><input type="submit" value="Go" /></noscript>
00567 </form>
00568 </td>
00569 </tr>
00570 <?php
00571 }
00572 echo "\n";
00573 ?>
00574
00575 <!-- Documentation -->
00576 <tr>
00577 <td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
00578 <td>
00579 <a href="Documentation.html" target="documentation"><b><?php echo $strPmaDocumentation; ?></b></a>
00580 </td>
00581 </tr>
00582
00583 <?php
00584 if ($is_superuser || $cfg['ShowPhpInfo']) {
00585 ?>
00586 <!-- PHP Information -->
00587 <tr>
00588 <td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
00589 <td>
00590 <a href="phpinfo.php?<?php echo PMA_generate_common_url(); ?>" target="_blank"><?php echo $strShowPHPInfo; ?></a>
00591 </td>
00592 </tr>
00593 <?php
00594 }
00595 echo "\n";
00596 ?>
00597
00598 <!-- phpMyAdmin related urls -->
00599 <tr>
00600 <td valign="baseline"><img src="<?php echo $item_img; ?>" width="7" height="7" alt="item" /></td>
00601 <td>
00602 <a href="http://www.phpMyAdmin.net/" target="_blank"><?php echo $strHomepageOfficial; ?></a><br />
00603 [<a href="ChangeLog" target="_blank">ChangeLog</a>]
00604 [<a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/phpmyadmin/phpMyAdmin/" target="_blank">CVS</a>]
00605 [<a href="http://sourceforge.net/mail/?group_id=23067" target="_blank">Lists</a>]
00606 </td>
00607 </tr>
00608 </table>
00609 </td>
00610
00611 </tr>
00612 </table>
00613
00614
00615 <?php
00619 if ($display_pmaAbsoluteUri_warning) {
00620 echo '<p class="warning">' . $strPmaUriError . '</p>' . "\n";
00621 }
00622
00626 if ($server != 0
00627 && $cfg['Server']['user'] == 'root'
00628 && $cfg['Server']['password'] == '') {
00629 echo '<p class="warning">' . $strInsecureMySQL . '</p>' . "\n";
00630 }
00631
00636 if (PMA_PHP_INT_VERSION == 40203 && @extension_loaded('mbstring')) {
00637 echo '<p class="warning">' . $strPHP40203 . '</p>' . "\n";
00638 }
00639
00644 if (PMA_PHP_INT_VERSION < 40100) {
00645 echo '<p class="warning">' . sprintf($strUpgrade, 'PHP', '4.1.0') . '</p>' . "\n";
00646 }
00647
00652
00653 if (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION < 32332) {
00654 echo '<p class="warning">' . sprintf($strUpgrade, 'MySQL', '3.23.32') . '</p>' . "\n";
00655 }
00656
00660 echo "\n";
00661 require_once('./footer.inc.php');
00662 ?>