print17
[auf_bulletin.git] / logout.php
1 <?php
2 /**
3 * Fichier de Logout
4 *
5 * PHP versions 4 et 5
6 *
7 * LODEL - Logiciel d'Edition ELectronique.
8 *
9 * Copyright (c) 2001-2002, Ghislain Picard, Marin Dacos
10 * Copyright (c) 2003, Ghislain Picard, Marin Dacos, Luc Santeramo, Nicolas Nutten, Anne Gentil-Beccot
11 * Copyright (c) 2004, Ghislain Picard, Marin Dacos, Luc Santeramo, Anne Gentil-Beccot, Bruno Cénou
12 * Copyright (c) 2005, Ghislain Picard, Marin Dacos, Luc Santeramo, Gautier Poupeau, Jean Lamy, Bruno Cénou
13 * Copyright (c) 2006, Marin Dacos, Luc Santeramo, Bruno Cénou, Jean Lamy, Mikaël Cixous, Sophie Malafosse
14 * Copyright (c) 2007, Marin Dacos, Bruno Cénou, Sophie Malafosse, Pierre-Alain Mignot
15 * Copyright (c) 2008, Marin Dacos, Bruno Cénou, Pierre-Alain Mignot, Inès Secondat de Montesquieu, Jean-François Rivière
16 * Copyright (c) 2009, Marin Dacos, Bruno Cénou, Pierre-Alain Mignot, Inès Secondat de Montesquieu, Jean-François Rivière
17 *
18 * Home page: http://www.lodel.org
19 *
20 * E-Mail: lodel@lodel.org
21 *
22 * All Rights Reserved
23 *
24 * This program is free software; you can redistribute it and/or modify
25 * it under the terms of the GNU General Public License as published by
26 * the Free Software Foundation; either version 2 of the License, or
27 * (at your option) any later version.
28 *
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
33 *
34 * You should have received a copy of the GNU General Public License
35 * along with this program; if not, write to the Free Software
36 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
37 *
38 * @author Ghislain Picard
39 * @author Jean Lamy
40 * @copyright 2001-2002, Ghislain Picard, Marin Dacos
41 * @copyright 2003, Ghislain Picard, Marin Dacos, Luc Santeramo, Nicolas Nutten, Anne Gentil-Beccot
42 * @copyright 2004, Ghislain Picard, Marin Dacos, Luc Santeramo, Anne Gentil-Beccot, Bruno Cénou
43 * @copyright 2005, Ghislain Picard, Marin Dacos, Luc Santeramo, Gautier Poupeau, Jean Lamy, Bruno Cénou
44 * @copyright 2006, Marin Dacos, Luc Santeramo, Bruno Cénou, Jean Lamy, Mikaël Cixous, Sophie Malafosse
45 * @copyright 2007, Marin Dacos, Bruno Cénou, Sophie Malafosse, Pierre-Alain Mignot
46 * @copyright 2008, Marin Dacos, Bruno Cénou, Pierre-Alain Mignot, Inès Secondat de Montesquieu, Jean-François Rivière
47 * @copyright 2009, Marin Dacos, Bruno Cénou, Pierre-Alain Mignot, Inès Secondat de Montesquieu, Jean-François Rivière
48 * @licence http://www.gnu.org/copyleft/gpl.html
49 * @version CVS:$Id:
50 * @package lodel/source/lodel/admin
51 */
52
53 require 'siteconfig.php';
54
55 try
56 {
57 include 'auth.php';
58 authenticate();
59 $time = time()-1;
60
61 if(isset($_COOKIE[C::get('sessionname', 'cfg')]))
62 {
63 $name = addslashes($_COOKIE[C::get('sessionname', 'cfg')]);
64
65 $db->execute(lq("
66 UPDATE #_MTP_session
67 SET expire2='$time'
68 WHERE name='$name'"))
69 or trigger_error("SQL ERROR :<br />".$GLOBALS['db']->ErrorMsg(), E_USER_ERROR);
70
71 $db->execute(lq("
72 DELETE FROM #_MTP_urlstack
73 WHERE idsession='".C::get('idsession', 'lodeluser')."'"))
74 or trigger_error("SQL ERROR :<br />".$GLOBALS['db']->ErrorMsg(), E_USER_ERROR);
75
76 setcookie(C::get('sessionname', 'cfg'), "", $time,C::get('urlroot', 'cfg'));
77 }
78
79 @setcookie('language', '', $time, C::get('urlroot', 'cfg'));
80
81 // la norme ne supporte pas les chemins relatifs !! :/
82 if(C::get('url_retour'))
83 header('Location: '.C::get('url_retour'));
84 else
85 {
86 header('Location: '.('' !== SITEROOT ? SITEROOT : './'));
87 }
88 }
89 catch(LodelException $e)
90 {
91 echo $e->getContent();
92 exit();
93 }
94 ?>