Source for file class.authHTTP.php
Documentation is available at class.authHTTP.php
* Fichier de la classe AuthHTTP
* LODEL - Logiciel d'Edition ELectronique.
* Copyright (c) 2001-2002, Ghislain Picard, Marin Dacos
* Copyright (c) 2003, Ghislain Picard, Marin Dacos, Luc Santeramo, Nicolas Nutten, Anne Gentil-Beccot
* Copyright (c) 2004, Ghislain Picard, Marin Dacos, Luc Santeramo, Anne Gentil-Beccot, Bruno Cénou
* Copyright (c) 2005, Ghislain Picard, Marin Dacos, Luc Santeramo, Gautier Poupeau, Jean Lamy, Bruno Cénou
* Copyright (c) 2006, Marin Dacos, Luc Santeramo, Bruno Cénou, Jean Lamy, Mikaël Cixous, Sophie Malafosse
* Copyright (c) 2007, Marin Dacos, Bruno Cénou, Sophie Malafosse, Pierre-Alain Mignot
* Home page: http://www.lodel.org
* E-Mail: lodel@lodel.org
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* @author Sophie Malafosse
* @licence http://www.gnu.org/copyleft/gpl.html
* @since Fichier ajouté depuis la version 0.8
* Classe permettant l'authentification HTTP
* <p>Cette classe est utilisée pour l'authentification HTTP (basic)</p>
* @author Ghislain Picard
* @licence http://www.gnu.org/copyleft/gpl.html
* @since Fichier ajouté depuis la version 0.8
* @see src/edition/index.php
* Login récupéré dans le header
* Mot de passe récupéré dans le header
* retourne un booléen : true si le login et le mot de passe sont récupérés,
if (!isset ($_SERVER['PHP_AUTH_USER']) || !isset ($_SERVER['PHP_AUTH_PW']))
// variables non initialisées
elseif (isset ($_SERVER['PHP_AUTH_USER']) && isset ($_SERVER['PHP_AUTH_PW']))
// récupère le login et le mot de passe
$this->login = $_SERVER['PHP_AUTH_USER'];
$this->password = $_SERVER['PHP_AUTH_PW'];
* Renvoi du header avec demande d'authentification
header('WWW-Authenticate: Basic realm="Authentification requise"');
header('HTTP/1.0 401 Unauthorized');
echo "L'accès à cette ressource requiert une authentification : veuillez entrer le nom d'utilisateur
et le mot de passe que vous utilisez sous Lodel";
* initialisation des variables
* Retourne dans un tableau le login et le mot de passe
|