From aaded59105253ecdbefa3ecf65de6bf16a8eec44 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sat, 9 Feb 2002 16:59:45 +0000 Subject: [PATCH] cookies test --- ChangeLog | 5 +++++ libraries/auth/cookie.auth.lib.php3 | 13 +++++++++---- main.php3 | 3 ++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 21251d78f..2aafce74a 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,11 @@ phpMyAdmin - Changelog $Id$ $Source$ +2002-02-09 Marc Delisle + * main.php3, libraries/auth/cookie.auth.lib.php3, Patch + 495360 (cookie with domain), experimental, thanks to + Piotr Roszatycki (d3xter) and Christoph (certelt) + 2002-02-09 Loïc Chapeaux * libraries/functions.js: improved the "mark row" feature (it wasn't working with Mozilla, for example). diff --git a/libraries/auth/cookie.auth.lib.php3 b/libraries/auth/cookie.auth.lib.php3 index 1040a1c05..9dc4b7786 100644 --- a/libraries/auth/cookie.auth.lib.php3 +++ b/libraries/auth/cookie.auth.lib.php3 @@ -269,7 +269,8 @@ if (uname.value == '') { // The user wants to be logged out -> delete password cookie if (!empty($old_usr)) { - setcookie('pma_cookie_password', ''); + setcookie('pma_cookie_password', '',0, + substr($SCRIPT_NAME, 0, strrpos($SCRIPT_NAME, '/'))); } // The user just logged in @@ -358,9 +359,12 @@ if (uname.value == '') { // Set cookies if required (once per session) if (!$from_cookie) { // Duration = one month for username - setcookie('pma_cookie_username', $cfgServer['user'], time() + (60 * 60 * 24 * 30)); + setcookie('pma_cookie_username', $cfgServer['user'], + time() + (60 * 60 * 24 * 30), + substr($SCRIPT_NAME, 0, strrpos($SCRIPT_NAME, '/'))); // Duration = till the browser is closed for password - setcookie('pma_cookie_password', $cfgServer['password']); + setcookie('pma_cookie_password', $cfgServer['password'],0, + substr($SCRIPT_NAME, 0, strrpos($SCRIPT_NAME, '/'))); } return TRUE; @@ -377,7 +381,8 @@ if (uname.value == '') { function PMA_auth_fails() { // Deletes password cookie and displays the login form - setcookie('pma_cookie_password', ''); + setcookie('pma_cookie_password', '',0, + substr($SCRIPT_NAME, 0, strrpos($SCRIPT_NAME, '/'))); PMA_auth(); return TRUE; diff --git a/main.php3 b/main.php3 index dd4e73c75..42347c8e8 100755 --- a/main.php3 +++ b/main.php3 @@ -8,7 +8,8 @@ require('./libraries/grab_globals.lib.php3'); require('./libraries/common.lib.php3'); // Puts the language to use in a cookie that will expire in 30 days -setcookie('lang', $lang, time() + 60*60*24*30); +setcookie('lang', $lang, time() + 60*60*24*30, + substr($SCRIPT_NAME, 0, strrpos($SCRIPT_NAME, '/')) ); // Defines the "item" image depending on text direction $item_img = 'images/item_' . $text_dir . '.gif'; // Handles some variables that may have been sent by the calling script