Subversion Repositories Sites.tela-botanica.org

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 david 1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
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
// +------------------------------------------------------------------------------------------------------+
41
 
42
set_include_path ('.:/usr/local/lib/php:/home/telabotap/www/actu/:/home/telabotap/www/') ;
43
 
44
// Cette variable contiendra le javascript de validation des formulaires
45
$GLOBALS['javascript'] = '' ;
46
 
47
 
48
include_once "Auth.php" ;
49
include_once "DB.php" ;
50
 
51
include_once 'papyrus/configuration/pap_config.inc.php' ;
52
 
53
$url = $_SERVER["REQUEST_URI"] ;
54
if ($_SERVER['SCRIPT_NAME'] == '/actu/index.php') {
55
    $url .= 'sommaire.php3' ;
56
}
57
function AUTH_formulaire_login ($url) {
58
 
59
     // l'url de la page en cours
60
    //--------------------------------------------------------------------------
61
    // Le formulaire
62
    //--------------------------------------------------------------------------
63
    $res ='<form id="form_connexion" class="form_identification" action="'.$url.'" method="post">
64
                <fieldset>
65
                    <legend>Identifiez vous</legend>
66
                        <label for="username">Courriel : </label>
67
                        <input type="text" size="12" id="username" name="username" maxlength="80" tabindex="1" value="courriel" />
68
                        <label for="password">Mot de passe : </label>
69
                        <input type="password" size="12" id="password" name="password" maxlength="80" tabindex="2" value="mot de passe" />
70
                        <input type="submit" id="connexion" name="connexion" tabindex="3" value="ok" />
71
                <p><a id="lien_inscription" href="/inscription">S\'inscrire...</a></p>
72
                </fieldset>
73
                </form>' ;
74
    return $res;
75
}
76
 
77
 
78
// Connection à la base de donnée
79
$GLOBALS['db'] = & DB::connect(PAP_DSN) ;
80
 
81
$param_auth = array ('dsn' => PAP_DSN,
82
                     'table' => 'annuaire_tela',
83
                     'usernamecol' => 'U_MAIL',
84
                     'passwordcol' => 'U_PASSWD',
85
                     'cryptType' => 'md5',
86
                     'db_fields' => '*' ) ;
87
 
88
$AUTH = new Auth('DB', $param_auth, 'AUTH_formulaire_login', false) ;
89
 
90
 
91
 
92
$AUTH->setSessionname('gen_annuaire_tela');
93
 
94
$AUTH->setExpire (360000, true) ; // On place la duré du cookie à 3 mois
95
 
96
// J'ai ajouté la ligne qui suit parce que le $AUTH->setExpire ne semble pas fonctionner
97
// Elle fixe la durée de vie du cookie de session
98
session_set_cookie_params(360000) ;
99
 
100
 
101
// On débute une session
102
 
103
$AUTH->start() ;
104
 
105
 
106
// On teste si la variable logout existe, si oui, on deconnecte
107
if (isset($logout)) {
108
    $AUTH->logout();
109
}
110
 
111
$userid = $AUTH->getAuthData('U_ID') ;
112
include_once 'spip_cookie.php' ;
113
 
114
// +------------------------------------------------------------------------------------------------------+
115
// |                                           LISTE de FONCTIONS                                         |
116
// +------------------------------------------------------------------------------------------------------+
117
 
118
// +------------------------------------------------------------------------------------------------------+
119
// |                                            PIED du PROGRAMME                                         |
120
// +------------------------------------------------------------------------------------------------------+
121
                                           /*Partie non obligatoire*/
122
 
123
 
124
/* +--Fin du code ----------------------------------------------------------------------------------------+
125
*
126
* $Log: authentification.php,v $
127
* Revision 1.2  2004/09/03 15:51:06  tam
128
* modif
129
*
130
*
131
* +-- Fin du code ----------------------------------------------------------------------------------------+
132
*/
133
?>