2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Misc stuff and REQUIRED by ALL the scripts.
5 * MUST be included by every script
7 * Among other things, it contains the advanced authentication work.
9 * Order of sections for common.inc.php:
11 * the authentication libraries must be before the connection to db
13 * ... so the required order is:
15 * LABEL_variables_init
16 * - initialize some variables always needed
17 * LABEL_parsing_config_file
18 * - parsing of the configuration file
19 * LABEL_loading_language_file
20 * - loading language file
22 * - check and setup configured servers
26 * - load of MySQL extension (if necessary)
27 * - loading of an authentication library
29 * - authentication work
36 * Minimum PHP version; can't call PMA_fatalError() which uses a
37 * PHP 5 function, so cannot easily localize this message.
39 if (version_compare(PHP_VERSION
, '5.2.0', 'lt')) {
40 die('PHP 5.2+ is required');
44 * Backward compatibility for PHP 5.2
46 if (!defined('E_DEPRECATED')) {
47 define('E_DEPRECATED', 8192);
53 require_once './libraries/Error_Handler.class.php';
56 * initialize the error handler
58 $GLOBALS['error_handler'] = new PMA_Error_Handler();
59 $cfg['Error_Handler']['display'] = TRUE;
61 // at this point PMA_PHP_INT_VERSION is not yet defined
62 if (version_compare(phpversion(), '6', 'lt')) {
64 * Avoid object cloning errors
66 @ini_set
('zend.ze1_compatibility_mode', false);
69 * Avoid problems with magic_quotes_runtime
71 @ini_set
('magic_quotes_runtime', false);
75 * for verification in all procedural scripts under libraries
77 define('PHPMYADMIN', true);
82 require_once './libraries/core.lib.php';
87 require_once './libraries/sanitizing.lib.php';
92 require_once './libraries/Theme.class.php';
95 * the PMA_Theme_Manager class
97 require_once './libraries/Theme_Manager.class.php';
100 * the PMA_Config class
102 require_once './libraries/Config.class.php';
105 * the relation lib, tracker needs it
107 require_once './libraries/relation.lib.php';
110 * the PMA_Tracker class
112 require_once './libraries/Tracker.class.php';
115 * the PMA_Table class
117 require_once './libraries/Table.class.php';
119 if (!defined('PMA_MINIMUM_COMMON')) {
123 require_once './libraries/common.lib.php';
126 * Java script escaping.
128 require_once './libraries/js_escape.lib.php';
131 * Include URL/hidden inputs generating.
133 require_once './libraries/url_generating.lib.php';
136 /******************************************************************************/
137 /* start procedural code label_start_procedural */
140 * protect against possible exploits - there is no need to have so much variables
142 if (count($_REQUEST) > 1000) {
143 die('possible exploit');
147 * Check for numeric keys
148 * (if register_globals is on, numeric key can be found in $GLOBALS)
150 foreach ($GLOBALS as $key => $dummy) {
151 if (is_numeric($key)) {
152 die('numeric key detected');
158 * PATH_INFO could be compromised if set, so remove it from PHP_SELF
159 * and provide a clean PHP_SELF here
161 $PMA_PHP_SELF = PMA_getenv('PHP_SELF');
162 $_PATH_INFO = PMA_getenv('PATH_INFO');
163 if (! empty($_PATH_INFO) && ! empty($PMA_PHP_SELF)) {
164 $path_info_pos = strrpos($PMA_PHP_SELF, $_PATH_INFO);
165 if ($path_info_pos +
strlen($_PATH_INFO) === strlen($PMA_PHP_SELF)) {
166 $PMA_PHP_SELF = substr($PMA_PHP_SELF, 0, $path_info_pos);
169 $PMA_PHP_SELF = htmlspecialchars($PMA_PHP_SELF);
173 * just to be sure there was no import (registering) before here
174 * we empty the global space (but avoid unsetting $variables_list
175 * and $key in the foreach(), we still need them!)
177 $variables_whitelist = array (
189 'variables_whitelist',
193 foreach (get_defined_vars() as $key => $value) {
194 if (! in_array($key, $variables_whitelist)) {
198 unset($key, $value, $variables_whitelist);
202 * Subforms - some functions need to be called by form, cause of the limited URL
203 * length, but if this functions inside another form you cannot just open a new
204 * form - so phpMyAdmin uses 'arrays' inside this form
208 * ... main form elments ...
209 * <input type="hidden" name="subform[action1][id]" value="1" />
210 * ... other subform data ...
211 * <input type="submit" name="usesubform[action1]" value="do action1" />
212 * ... other subforms ...
213 * <input type="hidden" name="subform[actionX][id]" value="X" />
214 * ... other subform data ...
215 * <input type="submit" name="usesubform[actionX]" value="do actionX" />
216 * ... main form elments ...
217 * <input type="submit" name="main_action" value="submit form" />
221 * so we now check if a subform is submitted
224 if (isset($_POST['usesubform'])) {
225 // if a subform is present and should be used
226 // the rest of the form is deprecated
227 $subform_id = key($_POST['usesubform']);
228 $subform = $_POST['subform'][$subform_id];
230 $_REQUEST = $subform;
232 * some subforms need another page than the main form, so we will just
233 * include this page at the end of this script - we use $__redirect to
236 if (isset($_POST['redirect'])
237 && $_POST['redirect'] != basename($PMA_PHP_SELF)) {
238 $__redirect = $_POST['redirect'];
239 unset($_POST['redirect']);
241 unset($subform_id, $subform);
243 // Note: here we overwrite $_REQUEST so that it does not contain cookies,
244 // because another application for the same domain could have set
245 // a cookie (with a compatible path) that overrides a variable
246 // we expect from GET or POST.
247 // We'll refer to cookies explicitly with the $_COOKIE syntax.
248 $_REQUEST = array_merge($_GET, $_POST);
250 // end check if a subform is submitted
252 // remove quotes added by php
253 if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
254 PMA_arrayWalkRecursive($_GET, 'stripslashes', true);
255 PMA_arrayWalkRecursive($_POST, 'stripslashes', true);
256 PMA_arrayWalkRecursive($_COOKIE, 'stripslashes', true);
257 PMA_arrayWalkRecursive($_REQUEST, 'stripslashes', true);
261 * clean cookies on upgrade
262 * when changing something related to PMA cookies, increment the cookie version
264 $pma_cookie_version = 4;
266 && (isset($_COOKIE['pmaCookieVer'])
267 && $_COOKIE['pmaCookieVer'] < $pma_cookie_version)) {
268 // delete all cookies
269 foreach($_COOKIE as $cookie_name => $tmp) {
270 PMA_removeCookie($cookie_name);
273 PMA_setCookie('pmaCookieVer', $pma_cookie_version);
277 * include deprecated grab_globals only if required
279 if (empty($__redirect) && !defined('PMA_NO_VARIABLES_IMPORT')) {
280 require './libraries/grab_globals.lib.php';
284 * check timezone setting
285 * this could produce an E_STRICT - but only once,
286 * if not done here it will produce E_STRICT on every date/time function
288 * @todo need to decide how we should handle this (without @)
290 date_default_timezone_set(@date_default_timezone_get
());
293 * include session handling after the globals, to prevent overwriting
295 require_once './libraries/session.inc.php';
298 * init some variables LABEL_variables_init
302 * holds parameters to be passed to next page
303 * @global array $GLOBALS['url_params']
305 $GLOBALS['url_params'] = array();
308 * the whitelist for $GLOBALS['goto']
309 * @global array $goto_whitelist
311 $goto_whitelist = array(
312 //'browse_foreigners.php',
320 'db_importdocsql.php',
327 //'Documentation.html',
341 'server_collations.php',
342 'server_databases.php',
343 'server_engines.php',
346 'server_privileges.php',
347 'server_processlist.php',
350 'server_variables.php',
362 'tbl_operations.php',
366 'tbl_row_action.php',
369 'transformation_overview.php',
370 'transformation_wrapper.php',
376 * check $__redirect against whitelist
378 if (! PMA_checkPageValidity($__redirect, $goto_whitelist)) {
383 * holds page that should be displayed
384 * @global string $GLOBALS['goto']
386 $GLOBALS['goto'] = '';
387 // Security fix: disallow accessing serious server files via "?goto="
388 if (PMA_checkPageValidity($_REQUEST['goto'], $goto_whitelist)) {
389 $GLOBALS['goto'] = $_REQUEST['goto'];
390 $GLOBALS['url_params']['goto'] = $_REQUEST['goto'];
392 unset($_REQUEST['goto'], $_GET['goto'], $_POST['goto'], $_COOKIE['goto']);
397 * @global string $GLOBALS['back']
399 if (PMA_checkPageValidity($_REQUEST['back'], $goto_whitelist)) {
400 $GLOBALS['back'] = $_REQUEST['back'];
402 unset($_REQUEST['back'], $_GET['back'], $_POST['back'], $_COOKIE['back']);
406 * Check whether user supplied token is valid, if not remove any possibly
407 * dangerous stuff from request.
409 * remember that some objects in the session with session_start and __wakeup()
410 * could access this variables before we reach this point
411 * f.e. PMA_Config: fontsize
413 * @todo variables should be handled by their respective owners (objects)
414 * f.e. lang, server, convcharset, collation_connection in PMA_Config
416 if (! PMA_isValid($_REQUEST['token']) ||
$_SESSION[' PMA_token '] != $_REQUEST['token']) {
418 * List of parameters which are allowed from unsafe source
421 /* needed for direct access, see FAQ 1.34
422 * also, server needed for cookie login screen (multi-server)
424 'server', 'db', 'table', 'target',
427 /* Cookie preferences */
428 'pma_lang', 'pma_charset', 'pma_collation_connection',
429 /* Possible login form */
430 'pma_servername', 'pma_username', 'pma_password',
431 /* rajk - for playing blobstreamable media */
432 'media_type', 'custom_type', 'bs_reference',
433 /* rajk - for changing BLOB repository file MIME type */
434 'bs_db', 'bs_table', 'bs_ref', 'bs_new_mime_type'
437 * Require cleanup functions
439 require_once './libraries/cleanup.lib.php';
443 PMA_remove_request_vars($allow_list);
449 * @global string $GLOBALS['convcharset']
450 * @see select_lang.lib.php
452 if (isset($_REQUEST['convcharset'])) {
453 $GLOBALS['convcharset'] = strip_tags($_REQUEST['convcharset']);
457 * current selected database
458 * @global string $GLOBALS['db']
461 if (PMA_isValid($_REQUEST['db'])) {
462 // can we strip tags from this?
463 // only \ and / is not allowed in db names for MySQL
464 $GLOBALS['db'] = $_REQUEST['db'];
465 $GLOBALS['url_params']['db'] = $GLOBALS['db'];
469 * current selected table
470 * @global string $GLOBALS['table']
472 $GLOBALS['table'] = '';
473 if (PMA_isValid($_REQUEST['table'])) {
474 // can we strip tags from this?
475 // only \ and / is not allowed in table names for MySQL
476 $GLOBALS['table'] = $_REQUEST['table'];
477 $GLOBALS['url_params']['table'] = $GLOBALS['table'];
481 * SQL query to be executed
482 * @global string $GLOBALS['sql_query']
484 $GLOBALS['sql_query'] = '';
485 if (PMA_isValid($_REQUEST['sql_query'])) {
486 $GLOBALS['sql_query'] = $_REQUEST['sql_query'];
490 * avoid problems in phpmyadmin.css.php in some cases
491 * @global string $js_frame
493 $_REQUEST['js_frame'] = PMA_ifSetOr($_REQUEST['js_frame'], '');
495 //$_REQUEST['set_theme'] // checked later in this file LABEL_theme_setup
496 //$_REQUEST['server']; // checked later in this file
497 //$_REQUEST['lang']; // checked by LABEL_loading_language_file
501 * holds name of JavaScript files to be included in HTML header
502 * @global array $js_include
504 $GLOBALS['js_include'] = array();
507 * holds locale messages required by JavaScript function
508 * @global array $js_messages
510 $GLOBALS['js_messages'] = array();
513 * JavaScript events that will be registered
514 * @global array $js_events
516 $GLOBALS['js_events'] = array();
519 * footnotes to be displayed ot the page bottom
520 * @global array $footnotes
522 $GLOBALS['footnotes'] = array();
524 /******************************************************************************/
525 /* parsing configuration file LABEL_parsing_config_file */
528 * We really need this one!
530 if (! function_exists('preg_replace')) {
531 PMA_fatalError('strCantLoad', 'pcre');
535 * @global PMA_Config $_SESSION['PMA_Config']
536 * force reading of config file, because we removed sensitive values
537 * in the previous iteration
539 $_SESSION['PMA_Config'] = new PMA_Config('./config.inc.php');
541 if (!defined('PMA_MINIMUM_COMMON')) {
542 $_SESSION['PMA_Config']->checkPmaAbsoluteUri();
546 * BC - enable backward compatibility
547 * exports all configuration settings into $GLOBALS ($GLOBALS['cfg'])
549 $_SESSION['PMA_Config']->enableBc();
553 * check HTTPS connection
555 if ($_SESSION['PMA_Config']->get('ForceSSL')
556 && !$_SESSION['PMA_Config']->get('is_https')) {
557 PMA_sendHeaderLocation(
558 preg_replace('/^http/', 'https',
559 $_SESSION['PMA_Config']->get('PmaAbsoluteUri'))
560 . PMA_generate_common_url($_GET, 'text'));
561 // delete the current session, otherwise we get problems (see bug #2397877)
562 PMA_removeCookie($GLOBALS['session_name']);
567 /******************************************************************************/
568 /* loading language file LABEL_loading_language_file */
571 * Added messages while developing:
573 if (file_exists('./lang/added_messages.php')) {
574 include './lang/added_messages.php';
578 * lang detection is done here
580 require_once './libraries/select_lang.lib.php';
583 * check for errors occurred while loading configuration
584 * this check is done here after loading language files to present errors in locale
586 if ($_SESSION['PMA_Config']->error_config_file
) {
587 $error = $strConfigFileError
589 . ($_SESSION['PMA_Config']->getSource() == './config.inc.php' ?
590 '<a href="show_config_errors.php"'
591 .' target="_blank">' . $_SESSION['PMA_Config']->getSource() . '</a>'
593 '<a href="' . $_SESSION['PMA_Config']->getSource() . '"'
594 .' target="_blank">' . $_SESSION['PMA_Config']->getSource() . '</a>');
595 trigger_error($error, E_USER_ERROR
);
597 if ($_SESSION['PMA_Config']->error_config_default_file
) {
598 $error = sprintf($strConfigDefaultFileError,
599 $_SESSION['PMA_Config']->default_source
);
600 trigger_error($error, E_USER_ERROR
);
602 if ($_SESSION['PMA_Config']->error_pma_uri
) {
603 trigger_error($strPmaUriError, E_USER_ERROR
);
607 /******************************************************************************/
608 /* setup servers LABEL_setup_servers */
612 * @global integer $GLOBALS['server']
614 $GLOBALS['server'] = 0;
617 * Servers array fixups.
618 * $default_server comes from PMA_Config::enableBc()
619 * @todo merge into PMA_Config
621 // Do we have some server?
622 if (!isset($cfg['Servers']) ||
count($cfg['Servers']) == 0) {
623 // No server => create one with defaults
624 $cfg['Servers'] = array(1 => $default_server);
626 // We have server(s) => apply default configuration
627 $new_servers = array();
629 foreach ($cfg['Servers'] as $server_index => $each_server) {
631 // Detect wrong configuration
632 if (!is_int($server_index) ||
$server_index < 1) {
633 trigger_error(sprintf($strInvalidServerIndex, $server_index), E_USER_ERROR
);
636 $each_server = array_merge($default_server, $each_server);
638 // Don't use servers with no hostname
639 if ($each_server['connect_type'] == 'tcp' && empty($each_server['host'])) {
640 trigger_error(sprintf($strInvalidServerHostname, $server_index), E_USER_ERROR
);
643 // Final solution to bug #582890
644 // If we are using a socket connection
645 // and there is nothing in the verbose server name
646 // or the host field, then generate a name for the server
647 // in the form of "Server 2", localized of course!
648 if ($each_server['connect_type'] == 'socket' && empty($each_server['host']) && empty($each_server['verbose'])) {
649 $each_server['verbose'] = $GLOBALS['strServer'] . $server_index;
652 $new_servers[$server_index] = $each_server;
654 $cfg['Servers'] = $new_servers;
655 unset($new_servers, $server_index, $each_server);
659 unset($default_server);
662 /******************************************************************************/
663 /* setup themes LABEL_theme_setup */
665 if (isset($_REQUEST['custom_color_reset'])) {
666 unset($_SESSION['tmp_user_values']['custom_color']);
667 unset($_SESSION['tmp_user_values']['custom_color_rgb']);
668 } elseif (isset($_REQUEST['custom_color'])) {
669 $_SESSION['tmp_user_values']['custom_color'] = $_REQUEST['custom_color'];
670 $_SESSION['tmp_user_values']['custom_color_rgb'] = $_REQUEST['custom_color_rgb'];
673 * @global PMA_Theme_Manager $_SESSION['PMA_Theme_Manager']
675 if (! isset($_SESSION['PMA_Theme_Manager'])) {
676 $_SESSION['PMA_Theme_Manager'] = new PMA_Theme_Manager
;
679 * @todo move all __wakeup() functionality into session.inc.php
681 $_SESSION['PMA_Theme_Manager']->checkConfig();
684 // for the theme per server feature
685 if (isset($_REQUEST['server']) && !isset($_REQUEST['set_theme'])) {
686 $GLOBALS['server'] = $_REQUEST['server'];
687 $tmp = $_SESSION['PMA_Theme_Manager']->getThemeCookie();
689 $tmp = $_SESSION['PMA_Theme_Manager']->theme_default
;
691 $_SESSION['PMA_Theme_Manager']->setActiveTheme($tmp);
695 * @todo move into PMA_Theme_Manager::__wakeup()
697 if (isset($_REQUEST['set_theme'])) {
698 // if user selected a theme
699 $_SESSION['PMA_Theme_Manager']->setActiveTheme($_REQUEST['set_theme']);
704 * @global PMA_Theme $_SESSION['PMA_Theme']
706 $_SESSION['PMA_Theme'] = $_SESSION['PMA_Theme_Manager']->theme
;
711 * @global string $GLOBALS['theme']
713 $GLOBALS['theme'] = $_SESSION['PMA_Theme']->getName();
716 * @global string $GLOBALS['pmaThemePath']
718 $GLOBALS['pmaThemePath'] = $_SESSION['PMA_Theme']->getPath();
720 * the theme image path
721 * @global string $GLOBALS['pmaThemeImage']
723 $GLOBALS['pmaThemeImage'] = $_SESSION['PMA_Theme']->getImgPath();
726 * load layout file if exists
728 if (@file_exists
($_SESSION['PMA_Theme']->getLayoutFile())) {
729 include $_SESSION['PMA_Theme']->getLayoutFile();
731 * @todo remove if all themes are update use Navi instead of Left as frame name
733 if (! isset($GLOBALS['cfg']['NaviWidth'])
734 && isset($GLOBALS['cfg']['LeftWidth'])) {
735 $GLOBALS['cfg']['NaviWidth'] = $GLOBALS['cfg']['LeftWidth'];
739 if (! defined('PMA_MINIMUM_COMMON')) {
741 * Character set conversion.
743 require_once './libraries/charset_conversion.lib.php';
748 require_once './libraries/string.lib.php';
751 * Lookup server by name
752 * by Arnold - Helder Hosting
755 if (! empty($_REQUEST['server']) && is_string($_REQUEST['server'])
756 && ! is_numeric($_REQUEST['server'])) {
757 foreach ($cfg['Servers'] as $i => $server) {
758 if ($server['host'] == $_REQUEST['server']) {
759 $_REQUEST['server'] = $i;
763 if (is_string($_REQUEST['server'])) {
764 unset($_REQUEST['server']);
770 * If no server is selected, make sure that $cfg['Server'] is empty (so
771 * that nothing will work), and skip server authentication.
772 * We do NOT exit here, but continue on without logging into any server.
773 * This way, the welcome page will still come up (with no server info) and
774 * present a choice of servers in the case that there are multiple servers
775 * and '$cfg['ServerDefault'] = 0' is set.
778 if (isset($_REQUEST['server']) && (is_string($_REQUEST['server']) ||
is_numeric($_REQUEST['server'])) && ! empty($_REQUEST['server']) && ! empty($cfg['Servers'][$_REQUEST['server']])) {
779 $GLOBALS['server'] = $_REQUEST['server'];
780 $cfg['Server'] = $cfg['Servers'][$GLOBALS['server']];
782 if (!empty($cfg['Servers'][$cfg['ServerDefault']])) {
783 $GLOBALS['server'] = $cfg['ServerDefault'];
784 $cfg['Server'] = $cfg['Servers'][$GLOBALS['server']];
786 $GLOBALS['server'] = 0;
787 $cfg['Server'] = array();
790 $GLOBALS['url_params']['server'] = $GLOBALS['server'];
793 * Kanji encoding convert feature appended by Y.Kawada (2002/2/20)
795 if (function_exists('mb_convert_encoding')
796 && strpos($lang, 'ja-') !== false) {
797 require_once './libraries/kanji-encoding.lib.php';
799 * enable multibyte string support
801 define('PMA_MULTIBYTE_ENCODING', 1);
805 * save some settings in cookies
806 * @todo should be done in PMA_Config
808 PMA_setCookie('pma_lang', $GLOBALS['lang']);
809 PMA_setCookie('pma_charset', $GLOBALS['convcharset']);
810 PMA_setCookie('pma_collation_connection', $GLOBALS['collation_connection']);
812 $_SESSION['PMA_Theme_Manager']->setThemeCookie();
814 if (! empty($cfg['Server'])) {
817 * Loads the proper database interface for this server
819 require_once './libraries/database_interface.lib.php';
821 require_once './libraries/logging.lib.php';
823 // Gets the authentication library that fits the $cfg['Server'] settings
824 // and run authentication
826 // to allow HTTP or http
827 $cfg['Server']['auth_type'] = strtolower($cfg['Server']['auth_type']);
828 if (! file_exists('./libraries/auth/' . $cfg['Server']['auth_type'] . '.auth.lib.php')) {
829 PMA_fatalError($strInvalidAuthMethod . ' ' . $cfg['Server']['auth_type']);
832 * the required auth type plugin
834 require_once './libraries/auth/' . $cfg['Server']['auth_type'] . '.auth.lib.php';
836 if (!PMA_auth_check()) {
842 // Check IP-based Allow/Deny rules as soon as possible to reject the
844 // Based on mod_access in Apache:
845 // http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/aaa/mod_access.c?rev=1.37&content-type=text/vnd.viewcvs-markup
846 // Look at: "static int check_dir_access(request_rec *r)"
847 // Robbat2 - May 10, 2002
848 if (isset($cfg['Server']['AllowDeny'])
849 && isset($cfg['Server']['AllowDeny']['order'])) {
852 * ip based access library
854 require_once './libraries/ip_allow_deny.lib.php';
856 $allowDeny_forbidden = false; // default
857 if ($cfg['Server']['AllowDeny']['order'] == 'allow,deny') {
858 $allowDeny_forbidden = true;
859 if (PMA_allowDeny('allow')) {
860 $allowDeny_forbidden = false;
862 if (PMA_allowDeny('deny')) {
863 $allowDeny_forbidden = true;
865 } elseif ($cfg['Server']['AllowDeny']['order'] == 'deny,allow') {
866 if (PMA_allowDeny('deny')) {
867 $allowDeny_forbidden = true;
869 if (PMA_allowDeny('allow')) {
870 $allowDeny_forbidden = false;
872 } elseif ($cfg['Server']['AllowDeny']['order'] == 'explicit') {
873 if (PMA_allowDeny('allow')
874 && !PMA_allowDeny('deny')) {
875 $allowDeny_forbidden = false;
877 $allowDeny_forbidden = true;
879 } // end if ... elseif ... elseif
881 // Ejects the user if banished
882 if ($allowDeny_forbidden) {
883 PMA_log_user($cfg['Server']['user'], 'allow-denied');
886 unset($allowDeny_forbidden); //Clean up after you!
890 if (!$cfg['Server']['AllowRoot'] && $cfg['Server']['user'] == 'root') {
891 $allowDeny_forbidden = true;
892 PMA_log_user($cfg['Server']['user'], 'root-denied');
894 unset($allowDeny_forbidden); //Clean up after you!
897 // is a login without password allowed?
898 if (!$cfg['Server']['AllowNoPassword'] && $cfg['Server']['password'] == '') {
899 $login_without_password_is_forbidden = true;
900 PMA_log_user($cfg['Server']['user'], 'empty-denied');
902 unset($login_without_password_is_forbidden); //Clean up after you!
905 // Try to connect MySQL with the control user profile (will be used to
906 // get the privileges list for the current user but the true user link
907 // must be open after this one so it would be default one for all the
909 $controllink = false;
910 if ($cfg['Server']['controluser'] != '') {
911 $controllink = PMA_DBI_connect($cfg['Server']['controluser'],
912 $cfg['Server']['controlpass'], true);
915 // Connects to the server (validates user's login)
916 $userlink = PMA_DBI_connect($cfg['Server']['user'],
917 $cfg['Server']['password'], false);
919 if (! $controllink) {
920 $controllink = $userlink;
924 PMA_log_user($cfg['Server']['user']);
927 * with phpMyAdmin 3 we support MySQL >=5
928 * but only production releases:
931 if (PMA_MYSQL_INT_VERSION
< 50015) {
932 PMA_fatalError('strUpgrade', array('MySQL', '5.0.15'));
938 require_once './libraries/sqlparser.lib.php';
941 * SQL Validator interface code
943 require_once './libraries/sqlvalidator.lib.php';
946 * the PMA_List_Database class
948 require_once './libraries/PMA.php';
950 $pma->userlink
= $userlink;
951 $pma->controllink
= $controllink;
954 * some resetting has to be done when switching servers
956 if (isset($_SESSION['tmp_user_values']['previous_server']) && $_SESSION['tmp_user_values']['previous_server'] != $GLOBALS['server']) {
957 unset($_SESSION['tmp_user_values']['navi_limit_offset']);
959 $_SESSION['tmp_user_values']['previous_server'] = $GLOBALS['server'];
961 } // end server connecting
964 * check if profiling was requested and remember it
965 * (note: when $cfg['ServerDefault'] = 0, constant is not defined)
967 if (isset($_REQUEST['profiling']) && PMA_profilingSupported()) {
968 $_SESSION['profiling'] = true;
969 } elseif (isset($_REQUEST['profiling_form'])) {
970 // the checkbox was unchecked
971 unset($_SESSION['profiling']);
974 // rajk - library file for blobstreaming
975 require_once './libraries/blobstreaming.lib.php';
977 // rajk - checks for blobstreaming plugins and databases that support
978 // blobstreaming (by having the necessary tables for blobstreaming)
979 if (checkBLOBStreamingPlugins()) {
980 checkBLOBStreamableDatabases();
982 } // end if !defined('PMA_MINIMUM_COMMON')
984 // remove sensitive values from session
985 $_SESSION['PMA_Config']->set('blowfish_secret', '');
986 $_SESSION['PMA_Config']->set('Servers', '');
987 $_SESSION['PMA_Config']->set('default_server', '');
989 /* Tell tracker that it can actually work */
990 PMA_Tracker
::enable();
992 if (!empty($__redirect) && in_array($__redirect, $goto_whitelist)) {
994 * include subform target page