note 21714 modified in features.http-auth by vrana

From: Date: Tue, 17 Aug 2004 13:56:03 +0000
Subject: note 21714 modified in features.http-auth by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79930@lists.php.net to get a copy of this message
The definitive HTTP authorization code: <?php function login_error() { echo "error - login process failed." } if (!isset($PHP_AUTH_USER)) { header("WWW-Authenticate: Basic realm=\"Mosaic Authorization process\""); header("HTTP/1.0 401 Unauthorized"); //Result if user hits cancel button login_error(); } else { //check the login and password if('=>test on login and password<=') { //User is logged ... ... } else { //This re-asks three times the login and password. header( "WWW-Authenticate: Basic realm=\"Test Authentication System\""); header("HTTP/1.0 401 Unauthorized"); //Result if user does not give good login and pass login_error(); } } ?> --was-- The definitive HTTP authorization code: function login_error() { echo "error - login process failed." } if (!isset($PHP_AUTH_USER)) { header("WWW-Authenticate: Basic realm=\"Mosaic Authorization process\""); header("HTTP/1.0 401 Unauthorized"); //Result if user hits cancel button login_error(); } else { //check the login and password if('=>test on login and password<=') { //User is logged ... ... } else { //This re-asks three times the login and password. header( "WWW-Authenticate: Basic realm=\"Test Authentication System\""); header("HTTP/1.0 401 Unauthorized"); //Result if user does not give good login and pass login_error(); } } http://php.net/manual/en/features.http-auth.php

« previous php.notes (#79930) next »