David BERCOT wrote: > I use this program to force a user to authenticate : > if (!isset($_SERVER["PHP_AUTH_USER"])) { > header("WWW-Authenticate: Basic realm=\"Intranet SDSED\""); > header("HTTP/1.1 401 Unauthorized"); > } > Everything is ok except a detail : if the user makes a mistake (for > example, a bad password), the variable $_SERVER["PHP_AUTH_USER"] is > initialised. > So, if he wants to do again the above test, another identification won't > happen (because $_SERVER["PHP_AUTH_USER"] is already set). > I've tried : > $_SERVER["PHP_AUTH_USER"] = NULL; > without succes... > > Do you have a clue ? <? if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="'._PRODNAME.'"'); header('HTTP/1.0 401 Unauthorized'); echo "You are not authorized to enter this page"; } else { $inUser = $_SERVER['PHP_AUTH_USER']; $inPWD = $_SERVER['PHP_AUTH_PW']; if (strcmp($inUser, 'me') == 0 && strcmp($inPWD, 'me') == 0) { echo "logged in"; } else { header('WWW-Authenticate: Basic realm="'._PRODNAME.'"'); header('HTTP/1.0 401 Unauthorized'); echo "You are not authorized to enter this page"; } } ?> HTH Albert -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 267.14.21/235 - Release Date: 2006/01/19 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php