From fe797be8d4a27c0501ea59ff1260c628a91eed21 Mon Sep 17 00:00:00 2001 From: plegall Date: Tue, 4 May 2010 22:21:11 +0000 Subject: bug 1501 fixed: with apache_authentication, fall back to REDIRECT_REMOTE_USER if REMOTE_USER is not set. git-svn-id: http://piwigo.org/svn/trunk@6074 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/user.inc.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/user.inc.php b/include/user.inc.php index b21fba77a..9e0eab847 100644 --- a/include/user.inc.php +++ b/include/user.inc.php @@ -50,12 +50,26 @@ if (session_id()=="") } // using Apache authentication override the above user search -if ($conf['apache_authentication'] and isset($_SERVER['REMOTE_USER'])) +if ($conf['apache_authentication']) { - if (!($user['id'] = get_userid($_SERVER['REMOTE_USER']))) + $remote_user = null; + foreach (array('REMOTE_USER', 'REDIRECT_REMOTE_USER') as $server_key) { - register_user($_SERVER['REMOTE_USER'], '', '', false); - $user['id'] = get_userid($_SERVER['REMOTE_USER']); + if (isset($_SERVER[$server_key])) + { + $remote_user = $_SERVER[$server_key]; + echo $server_key; + break; + } + } + + if (isset($remote_user)) + { + if (!($user['id'] = get_userid($remote_user))) + { + register_user($remote_user, '', '', false); + $user['id'] = get_userid($remote_user); + } } } -- cgit v1.2.3