Improved a bit the detection mechanism

This commit is contained in:
Loïc Chapeaux
2002-05-26 13:09:35 +00:00
parent 1df9bd61b8
commit 405ff52b51
2 changed files with 9 additions and 4 deletions

View File

@@ -18,6 +18,7 @@ $Source$
- fixed a warning thanks to - fixed a warning thanks to
Svetlio Kovachev <svetlio at users.sourceforge.net>; Svetlio Kovachev <svetlio at users.sourceforge.net>;
- coding standards. - coding standards.
* libraries/auth/cookies.auth.php3: improved a bit the detection mechanism.
2002-05-25 Lo<4C>c Chapeaux <lolo@phpheaven.net> 2002-05-25 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* libraries/common.lib.php3: * libraries/common.lib.php3:

View File

@@ -92,6 +92,7 @@ if (!defined('PMA_COOKIE_AUTH_INCLUDED')) {
<head> <head>
<title>phpMyAdmin <?php echo PMA_VERSION; ?></title> <title>phpMyAdmin <?php echo PMA_VERSION; ?></title>
<base href="<?php echo $cfg['PmaAbsoluteUri']; ?>" />
<style type="text/css"> <style type="text/css">
<!-- <!--
body {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo $font_size; ?>; color: #000000} body {font-family: <?php echo $right_font_family; ?>; font-size: <?php echo $font_size; ?>; color: #000000}
@@ -298,24 +299,27 @@ if (uname.value == '') {
else { else {
if (!empty($pma_cookie_username)) { if (!empty($pma_cookie_username)) {
$PHP_AUTH_USER = $pma_cookie_username; $PHP_AUTH_USER = $pma_cookie_username;
$from_cookie = TRUE;
} }
else if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_username'])) { else if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_username'])) {
$PHP_AUTH_USER = $_COOKIE['pma_cookie_username']; $PHP_AUTH_USER = $_COOKIE['pma_cookie_username'];
$from_cookie = TRUE;
} }
else if (!empty($HTTP_COOKIE_VARS) && isset($HTTP_COOKIE_VARS['pma_cookie_username'])) { else if (!empty($HTTP_COOKIE_VARS) && isset($HTTP_COOKIE_VARS['pma_cookie_username'])) {
$PHP_AUTH_USER = $HTTP_COOKIE_VARS['pma_cookie_username']; $PHP_AUTH_USER = $HTTP_COOKIE_VARS['pma_cookie_username'];
$from_cookie = TRUE;
} }
if (!empty($pma_cookie_password)) { if (!empty($pma_cookie_password)) {
$PHP_AUTH_PW = $pma_cookie_password; $PHP_AUTH_PW = $pma_cookie_password;
$from_cookie = TRUE;
} }
else if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_password'])) { else if (!empty($_COOKIE) && isset($_COOKIE['pma_cookie_password'])) {
$PHP_AUTH_PW = $_COOKIE['pma_cookie_password']; $PHP_AUTH_PW = $_COOKIE['pma_cookie_password'];
$from_cookie = TRUE;
} }
else if (!empty($HTTP_COOKIE_VARS) && isset($HTTP_COOKIE_VARS['pma_cookie_password'])) { else if (!empty($HTTP_COOKIE_VARS) && isset($HTTP_COOKIE_VARS['pma_cookie_password'])) {
$PHP_AUTH_PW = $HTTP_COOKIE_VARS['pma_cookie_password']; $PHP_AUTH_PW = $HTTP_COOKIE_VARS['pma_cookie_password'];
$from_cookie = TRUE; }
else {
$from_cookie = FALSE;
} }
} }
@@ -377,7 +381,7 @@ if (uname.value == '') {
setcookie('pma_cookie_username', setcookie('pma_cookie_username',
$cfg['Server']['user'], $cfg['Server']['user'],
time() + (60 * 60 * 24 * 30), time() + (60 * 60 * 24 * 30),
$GLOBALS['cookie_path'], '' , $GLOBALS['cookie_path'], '',
$GLOBALS['is_https']); $GLOBALS['is_https']);
// Duration = till the browser is closed for password // Duration = till the browser is closed for password
setcookie('pma_cookie_password', setcookie('pma_cookie_password',