note 106285 added to features.http-auth

From: Date: Tue, 25 Oct 2011 00:32:26 +0000
Subject: note 106285 added to features.http-auth
Groups: php.notes 
Request: Send a blank email to php-notes+get-184115@lists.php.net to get a copy of this message
On my configuration with php-cgi - after setting the RewriteRule - the correct variable would be: $_SERVER['REDIRECT_HTTP_AUTHORIZATION'] So the workaround for PhpCGI is: Set in your .htaccess: RewriteEngine on RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last] Php workaround: <?php //set http auth headers for apache+php-cgi work around if (isset($_SERVER['HTTP_AUTHORIZATION']) && preg_match('/Basic\s+(.*)$/i', $_SERVER['HTTP_AUTHORIZATION'], $matches)) { list($name, $password) = explode(':', base64_decode($matches[1])); $_SERVER['PHP_AUTH_USER'] = strip_tags($name); $_SERVER['PHP_AUTH_PW'] = strip_tags($password); } //set http auth headers for apache+php-cgi work around if variable gets renamed by apache if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && preg_match('/Basic\s+(.*)$/i', $_SERVER['REDIRECT_HTTP_AUTHORIZATION'], $matches)) { list($name, $password) = explode(':', base64_decode($matches[1])); $_SERVER['PHP_AUTH_USER'] = strip_tags($name); $_SERVER['PHP_AUTH_PW'] = strip_tags($password); } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 2.214.211.156 ---- Manual Page -- http://www.php.net/manual/en/features.http-auth.php Edit -- https://master.php.net/note/edit/106285 Del: integrated -- https://master.php.net/note/delete/106285/integrated Del: useless -- https://master.php.net/note/delete/106285/useless Del: bad code -- https://master.php.net/note/delete/106285/bad+code Del: spam -- https://master.php.net/note/delete/106285/spam Del: non-english -- https://master.php.net/note/delete/106285/non-english Del: in docs -- https://master.php.net/note/delete/106285/in+docs Del: other reasons-- https://master.php.net/note/delete/106285 Reject -- https://master.php.net/note/reject/106285 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#184115) next »