[go: nahoru, domu]

Skip to content

Commit

Permalink
Don't destroy the session if logins are still present. fixes phpmyadm…
Browse files Browse the repository at this point in the history
…in#12301

If you are logged-in into multiple database servers, logOut() logs you out of all of them. This fix will prevent that, and will only destroy the session when you log out of the last server.
  • Loading branch information
WanWizard committed Apr 28, 2017
1 parent 1be3668 commit 5fab840
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions libraries/plugins/AuthenticationPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,17 @@ public function logOut()
$PHP_AUTH_USER = '';
$PHP_AUTH_PW = '';

/* Get a logged-in server count */
$servers = 0;
foreach ($GLOBALS['cfg']['Servers'] as $key => $val) {
if (isset($_COOKIE['pmaAuth-' . $key])) {
$servers++;
}
}

/* delete user's choices that were stored in session */
$_SESSION = array();
if (!defined('TESTSUITE')) {
if ($servers === 0 and ! defined('TESTSUITE')) {
$_SESSION = array();
session_destroy();
}

Expand Down

3 comments on commit 5fab840

@phpmyadmin-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit is missing Signed-Off-By line to indicate that you agree with phpMyAdmin Developer's Certificate of Origin. Please check contributing documentation for more information.

@WanWizard
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't find how you add that when using Github to send in a PR...

@nijel
Copy link
@nijel nijel commented on 5fab840 Apr 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just add Signed-Off-By: your name as last line in the commit message

Please sign in to comment.