note 105379 modified in features.http-auth by danbrown

From: Date: Sun, 14 Aug 2011 16:42:50 +0000
Subject: note 105379 modified in features.http-auth by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-182481@lists.php.net to get a copy of this message
Using sessions like this makes the enter auth values at each request <?php if($_SESSION['http_logged'] != 1) { $_SERVER['PHP_AUTH_USER'] = ''; $_SERVER['PHP_AUTH_PW'] = ''; } if ($_SERVER['PHP_AUTH_USER'] != $your_username || $_SERVER['PHP_AUTH_PW'] != $your_password ) { $_SESSION['http_logged'] = 1; header('WWW-Authenticate: Basic realm="realm"'); header('HTTP/1.0 401 Unauthorized'); exit; } else { $_SESSION['http_logged'] = 0; } ?> --was-- Using sessions like this makes the enter auth values at each request if($_SESSION['http_logged'] != 1) { $_SERVER['PHP_AUTH_USER'] = ''; $_SERVER['PHP_AUTH_PW'] = ''; } if ($_SERVER['PHP_AUTH_USER'] != $your_username || $_SERVER['PHP_AUTH_PW'] != $your_password ) { $_SESSION['http_logged'] = 1; header('WWW-Authenticate: Basic realm="realm"'); header('HTTP/1.0 401 Unauthorized'); exit; } else { $_SESSION['http_logged'] = 0; } http://php.net/manual/en/features.http-auth.php

« previous php.notes (#182481) next »