From 6ae0305dfcbcf1c88935d914f6d570fef5e60f6e Mon Sep 17 00:00:00 2001 From: Devops Date: Tue, 4 Apr 2017 13:54:45 +0100 Subject: [PATCH] www/dbq/dbq.php --- www/dbq/dbq.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index 06c650f0..30723237 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -671,6 +671,7 @@ EOF; [ 'databases', 'List others databases' ], [ 'cryptkey', 'Generate a random encryption key' ], [ 'ssha_password', 'Encrypt a password' ], + [ 'logout', 'Clear Basic Auth' ], [ 'status', 'Status infos page' ], ],['command','description'],function(&$r) { $r['command'] = $this->page->tag('a',$r['command'],'href="' @@ -688,6 +689,22 @@ EOF; $r['id'] = $this->page->tag('a',$r['id'],'href="'.$this->db->base.'/'.$r['id'].'.'.$this->ext.'"'); }); + } elseif ($action == 'logout') { + unset($_SERVER['PHP_AUTH_USER']); + unset($_SERVER['PHP_AUTH_PW']); + unset($_SERVER['REMOTE_USER']); + unset($_SERVER['REMOTE_PASSWORD']); + #header('HTTP/1.1 401 Access Denied'); + if (empty($_REQUEST['realm'])) header('WWW-Authenticate: Basic'); + else header('WWW-Authenticate: Basic realm="'.$_REQUEST['realm'].'"'); + #echo '401 Unauthorized

401 Unauthorized

You are not allowed to see this page. Reload the page to try again.

'; + header('HTTP/1.0 401 Unauthorized'); + #header('Location: '.str_replace('//','//@',(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/'))); + header('Content-type: text/html'); + echo ''; + #if (!empty($_SERVER['PHP_AUTH_USER'])) header('Location: '.str_replace('//','//@',(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/'))); + exit; + } elseif ($action == 'ssha_password') { $this->page($this,'ssha_password'); -- 2.47.3