Subversion Repositories Sites.tela-botanica.org

Rev

Rev 231 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 david 1
<?php
9 david 2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
4 david 3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | Lesser General Public License for more details.                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: authentification.php,v 1.2 2004/09/03 15:51:06 tam Exp $
23
/**
24
* Titre
25
*
26
* Description
27
*
28
*@package site_tela
29
//Auteur original :
30
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
31
//Autres auteurs :
32
*@author        Aucun
33
*@copyright     Tela-Botanica 2000-2004
34
*@version       $Revision: 1.2 $ $Date: 2004/09/03 15:51:06 $
35
// +------------------------------------------------------------------------------------------------------+
36
*/
37
 
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
190 jpm 41
set_include_path(get_include_path().PATH_SEPARATOR.dirname(realpath(__FILE__)).PATH_SEPARATOR.$_SERVER['DOCUMENT_ROOT']);
42
include_once dirname(realpath(__FILE__)).'/../papyrus/configuration/pap_config_avancee.inc.php' ;
43
include_once dirname(realpath(__FILE__)).'/../papyrus/configuration/pap_config.inc.php' ;
44
include_once PAP_CHEMIN_API_PEAR.'Auth.php' ;
45
include_once 'DB.php' ;
292 jpm 46
include_once 'Net/URL.php' ;
4 david 47
 
292 jpm 48
$NetUrl = new Net_URL();
49
$url = $NetUrl->getUrl();
190 jpm 50
// Connection à la base de donnée
51
$GLOBALS['db'] =& DB::connect(PAP_DSN) ;
52
 
4 david 53
// Cette variable contiendra le javascript de validation des formulaires
54
$GLOBALS['javascript'] = '' ;
55
 
292 jpm 56
 
4 david 57
if ($_SERVER['SCRIPT_NAME'] == '/actu/index.php') {
58
    $url .= 'sommaire.php3' ;
59
}
60
function AUTH_formulaire_login ($url) {
190 jpm 61
	// l'url de la page en cours
62
	//--------------------------------------------------------------------------
63
	// Le formulaire
64
	//--------------------------------------------------------------------------
65
	$res ='<form id="form_connexion" class="form_identification" action="'.$url.'" method="post">
66
				<fieldset>
67
					<legend>Identifiez vous</legend>
68
						<label for="username">Courriel : </label>
69
						<input type="text" size="12" id="username" name="username" maxlength="80" tabindex="1" value="courriel" />
70
						<label for="password">Mot de passe : </label>
71
						<input type="password" size="12" id="password" name="password" maxlength="80" tabindex="2" value="mot de passe" />
72
						<input type="submit" id="connexion" name="connexion" tabindex="3" value="ok" />
231 jpm 73
				<p><a id="lien_inscription" href="/page:inscription">S\'inscrire...</a></p>
190 jpm 74
				</fieldset>
75
			</form>' ;
76
	return $res;
4 david 77
}
78
 
79
$param_auth = array ('dsn' => PAP_DSN,
80
                     'table' => 'annuaire_tela',
81
                     'usernamecol' => 'U_MAIL',
82
                     'passwordcol' => 'U_PASSWD',
83
                     'cryptType' => 'md5',
190 jpm 84
                     'db_fields' => '*');
4 david 85
 
190 jpm 86
$GLOBALS['identification'] = new Auth('DB', $param_auth, 'AUTH_formulaire_login');
87
//session_name('gen_annuaire_tela');
88
//$GLOBALS['identification']->_sessionName = 'gen_annuaire_tela';
89
// ATTENTION : TODO : setSessionname ne marche pas ici. Le nom de la session n'est jamais initialisé est reste PHPSESSID
90
$GLOBALS['identification']->setSessionname('gen_annuaire_tela');
91
//echo session_name().'-'.$GLOBALS['identification']->_sessionName;
4 david 92
// On débute une session
190 jpm 93
$GLOBALS['identification']->start();
4 david 94
 
95
// On teste si la variable logout existe, si oui, on deconnecte
292 jpm 96
if (isset($logout) && $logout != '' && $GLOBALS['identification']->checkAuth()) {
231 jpm 97
	// On place les cookies avec une durée dépassée
98
    setcookie('spip_session', '', time() - 3600, '/actu/') ;
99
    setcookie('spip_admin', '', time() - 3600, '/actu/') ;
194 jpm 100
	$GLOBALS['identification']->logout();
292 jpm 101
	$NetUrl->removeQueryString('logout');
194 jpm 102
}
4 david 103
 
104
include_once 'spip_cookie.php' ;
105
 
106
// +------------------------------------------------------------------------------------------------------+
107
// |                                           LISTE de FONCTIONS                                         |
108
// +------------------------------------------------------------------------------------------------------+
109
 
110
// +------------------------------------------------------------------------------------------------------+
111
// |                                            PIED du PROGRAMME                                         |
112
// +------------------------------------------------------------------------------------------------------+
9 david 113
                                           /*Partie non obligatoire*/
4 david 114
 
115
 
116
/* +--Fin du code ----------------------------------------------------------------------------------------+
117
*
118
* $Log: authentification.php,v $
119
* Revision 1.2  2004/09/03 15:51:06  tam
120
* modif
121
*
122
*
123
* +-- Fin du code ----------------------------------------------------------------------------------------+
124
*/
125
?>