Subversion Repositories Sites.tela-botanica.org

Compare Revisions

Ignore whitespace Rev 3 → Rev 4

/trunk/actu/authentification.php
New file
0,0 → 1,133
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: authentification.php,v 1.2 2004/09/03 15:51:06 tam Exp $
/**
* Titre
*
* Description
*
*@package site_tela
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.2 $ $Date: 2004/09/03 15:51:06 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
set_include_path ('.:/usr/local/lib/php:/home/telabotap/www/actu/:/home/telabotap/www/') ;
 
// Cette variable contiendra le javascript de validation des formulaires
$GLOBALS['javascript'] = '' ;
 
 
include_once "Auth.php" ;
include_once "DB.php" ;
 
include_once 'papyrus/configuration/pap_config.inc.php' ;
 
$url = $_SERVER["REQUEST_URI"] ;
if ($_SERVER['SCRIPT_NAME'] == '/actu/index.php') {
$url .= 'sommaire.php3' ;
}
function AUTH_formulaire_login ($url) {
 
// l'url de la page en cours
//--------------------------------------------------------------------------
// Le formulaire
//--------------------------------------------------------------------------
$res ='<form id="form_connexion" class="form_identification" action="'.$url.'" method="post">
<fieldset>
<legend>Identifiez vous</legend>
<label for="username">Courriel : </label>
<input type="text" size="12" id="username" name="username" maxlength="80" tabindex="1" value="courriel" />
<label for="password">Mot de passe : </label>
<input type="password" size="12" id="password" name="password" maxlength="80" tabindex="2" value="mot de passe" />
<input type="submit" id="connexion" name="connexion" tabindex="3" value="ok" />
<p><a id="lien_inscription" href="/inscription">S\'inscrire...</a></p>
</fieldset>
</form>' ;
return $res;
}
 
 
// Connection à la base de donnée
$GLOBALS['db'] = & DB::connect(PAP_DSN) ;
 
$param_auth = array ('dsn' => PAP_DSN,
'table' => 'annuaire_tela',
'usernamecol' => 'U_MAIL',
'passwordcol' => 'U_PASSWD',
'cryptType' => 'md5',
'db_fields' => '*' ) ;
 
$AUTH = new Auth('DB', $param_auth, 'AUTH_formulaire_login', false) ;
 
 
 
$AUTH->setSessionname('gen_annuaire_tela');
 
$AUTH->setExpire (360000, true) ; // On place la duré du cookie à 3 mois
 
// J'ai ajouté la ligne qui suit parce que le $AUTH->setExpire ne semble pas fonctionner
// Elle fixe la durée de vie du cookie de session
session_set_cookie_params(360000) ;
 
 
// On débute une session
 
$AUTH->start() ;
 
 
// On teste si la variable logout existe, si oui, on deconnecte
if (isset($logout)) {
$AUTH->logout();
}
 
$userid = $AUTH->getAuthData('U_ID') ;
include_once 'spip_cookie.php' ;
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
/*Partie non obligatoire*/
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: authentification.php,v $
* Revision 1.2 2004/09/03 15:51:06 tam
* modif
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>