2
/* $Id: config.auth.lib.php,v 2.2 2003/11/26 22:52:24 rabus Exp $ */
2
/* $Id: config.auth.lib.php,v 2.9 2004/10/20 15:50:52 nijel Exp $ */
3
3
// vim: expandtab sw=4 ts=4 sts=4:
5
5
// +--------------------------------------------------------------------------+
6
// | Set of functions used to run config authentication (ie no |
6
// | Set of functions used to run config authentication (ie no |
7
7
// | authentication). |
8
8
// +--------------------------------------------------------------------------+
68
68
function PMA_auth_fails()
71
global $connect_func, $server_port, $server_socket, $cfg;
70
global $php_errormsg, $cfg;
72
71
global $right_font_family, $font_size, $font_bigger;
73
global $is_header_sent;
74
if (PMA_mysql_error()) {
75
$conn_error = PMA_mysql_error();
72
if (PMA_DBI_getError()) {
73
$conn_error = PMA_DBI_getError();
76
74
} else if (isset($php_errormsg)) {
77
75
$conn_error = $php_errormsg;
79
$conn_error = 'Cannot connect: invalid settings.';
77
$conn_error = $GLOBALS['strConnectionError'];
81
/* Commented out by Nijel: This causes displaying login and password from
82
* config when connection to MySQL server can't be established. (SQL parser
83
* fails on this and then displays it as wrong SQL.
85
/* $local_query = $connect_func . '('
86
. $cfg['Server']['host'] . $server_port . $server_socket . ', '
87
. $cfg['Server']['user'] . ', '
88
. $cfg['Server']['password'] . ')';*/
91
80
// Defines the charset to be used
92
81
header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
82
// Defines the theme to be used
83
require_once('./libraries/select_theme.lib.php');
94
85
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
95
86
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
104
95
h1 {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo $font_bigger; ?>; font-weight: bold}
98
<script language="JavaScript" type="text/javascript">
100
/* added 2004-06-10 by Michael Keck
101
* we need this for Backwards-Compatibility and resolving problems
102
* with non DOM browsers, which may have problems with css 2 (like NC 4)
104
var isDOM = (typeof(document.getElementsByTagName) != 'undefined'
105
&& typeof(document.createElement) != 'undefined')
107
var isIE4 = (typeof(document.all) != 'undefined'
108
&& parseInt(navigator.appVersion) >= 4)
110
var isNS4 = (typeof(document.layers) != 'undefined')
112
var capable = (isDOM || isIE4 || isNS4)
114
// Uggly fix for Opera and Konqueror 2.2 that are half DOM compliant
116
if (typeof(window.opera) != 'undefined') {
117
var browserName = ' ' + navigator.userAgent.toLowerCase();
118
if ((browserName.indexOf('konqueror 7') == 0)) {
121
} else if (typeof(navigator.userAgent) != 'undefined') {
122
var browserName = ' ' + navigator.userAgent.toLowerCase();
123
if ((browserName.indexOf('konqueror') > 0) && (browserName.indexOf('konqueror/3') == 0)) {
126
} // end if... else if...
128
document.writeln('<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/phpmyadmin.css.php?lang=<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>&js_frame=right&js_isDOM=' + isDOM + '" />');
132
<link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : './'; ?>css/phpmyadmin.css.php?lang=<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>&js_frame=right" />
109
137
<body bgcolor="<?php echo $cfg['RightBgColor']; ?>">
112
140
<h1><?php echo sprintf($GLOBALS['strWelcome'], ' phpMyAdmin ' . PMA_VERSION); ?></h1>
143
<table border="0" cellpadding="0" cellspacing="3" align="center" width="80%">
117
$is_header_sent = TRUE;
118
echo '<p>' . $GLOBALS['strAccessDeniedExplanation'] . '</p>' . "\n";
119
PMA_mysqlDie($conn_error, $local_query, FALSE);
148
$GLOBALS['is_header_sent'] = TRUE;
150
// if we display the "Server not responding" error, do not confuse users
151
// by telling them they have a settings problem
152
// (note: it's true that they could have a badly typed host name, but
153
// anyway the current $strAccessDeniedExplanation tells that the server
154
// rejected the connection, which is not really what happened)
155
// 2002 is the error given by mysqli
156
// 2003 is the error given by mysql
158
if (isset($GLOBALS['allowDeny_forbidden']) && $GLOBALS['allowDeny_forbidden']) {
159
echo '<p>' . $GLOBALS['strAccessDenied'] . '</p>' . "\n";
161
if (!isset($GLOBALS['errno']) || (isset($GLOBALS['errno']) && $GLOBALS['errno'] != 2002) && $GLOBALS['errno'] != 2003) {
162
echo '<p>' . $GLOBALS['strAccessDeniedExplanation'] . '</p>' . "\n";
164
PMA_mysqlDie($conn_error, '');
171
require_once('./footer.inc.php');
122
173
} // end of the 'PMA_auth_fails()' function