2004-10-20 23:06:45 +02:00
|
|
|
<?php
|
2009-04-17 20:35:16 +02:00
|
|
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2009-04-17 09:45:00 +02:00
|
|
|
* Copyright (C) 2003 Xavier Dutoit <doli@sydesy.com>
|
|
|
|
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
|
|
|
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
2003-08-30 14:17:08 +02:00
|
|
|
*
|
|
|
|
|
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
*/
|
2003-10-28 12:03:40 +01:00
|
|
|
|
2005-07-07 02:44:49 +02:00
|
|
|
/**
|
|
|
|
|
\file htdocs/user/logout.php
|
|
|
|
|
\brief Fichier de deconnexion
|
2008-05-02 03:10:00 +02:00
|
|
|
\version $Id$
|
2003-10-28 12:03:40 +01:00
|
|
|
*/
|
2004-08-14 15:17:07 +02:00
|
|
|
|
2008-05-02 03:10:00 +02:00
|
|
|
if ($_SESSION["dol_authmode"] == 'forceuser'
|
|
|
|
|
&& $_SESSION["dol_authmode"] == 'http')
|
|
|
|
|
{
|
2008-05-02 08:39:53 +02:00
|
|
|
die("Disconnection does not work when connection was made in mode ".$_SESSION["dol_authmode"]);
|
2008-05-02 03:10:00 +02:00
|
|
|
}
|
2004-07-27 16:56:03 +02:00
|
|
|
|
2004-07-27 17:00:52 +02:00
|
|
|
include_once("../conf/conf.php");
|
2007-12-31 01:02:26 +01:00
|
|
|
require_once("../main.inc.php");
|
2004-07-27 16:59:53 +02:00
|
|
|
|
2008-12-10 15:56:05 +01:00
|
|
|
// Define url to go after disconnect
|
|
|
|
|
$urlfrom=empty($_SESSION["urlfrom"])?'':$_SESSION["urlfrom"];
|
|
|
|
|
|
2009-04-15 22:09:43 +02:00
|
|
|
// Phenix module
|
2007-10-02 15:54:34 +02:00
|
|
|
if ($conf->phenix->enabled && $conf->phenix->cookie)
|
|
|
|
|
{
|
2009-04-15 22:09:43 +02:00
|
|
|
// Destroy cookie
|
2007-10-02 15:54:34 +02:00
|
|
|
setcookie($conf->phenix->cookie, '', 1, "/");
|
|
|
|
|
}
|
2006-07-02 02:43:40 +02:00
|
|
|
|
2008-10-26 13:59:56 +01:00
|
|
|
// Destroy session
|
|
|
|
|
$sessionname="DOLSESSID_".$dolibarr_main_db_name;
|
|
|
|
|
if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) ini_set('session.gc_maxlifetime',$conf->global->MAIN_SESSION_TIMEOUT);
|
|
|
|
|
session_name($sessionname);
|
2007-12-31 01:02:26 +01:00
|
|
|
session_destroy();
|
2009-02-20 23:53:15 +01:00
|
|
|
dol_syslog("End session in DOLSESSID_".$dolibarr_main_db_name);
|
2008-10-12 13:41:13 +02:00
|
|
|
|
|
|
|
|
// Init session
|
2008-10-10 22:39:16 +02:00
|
|
|
$sessionname="DOLSESSID_".$dolibarr_main_db_name;
|
2008-10-12 13:41:13 +02:00
|
|
|
if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) ini_set('session.gc_maxlifetime',$conf->global->MAIN_SESSION_TIMEOUT);
|
2008-10-10 22:39:16 +02:00
|
|
|
session_name($sessionname);
|
2006-07-02 02:43:40 +02:00
|
|
|
session_start();
|
2009-02-20 23:53:15 +01:00
|
|
|
dol_syslog("Start session name=".$sessionname." Session id()=".session_id().", _SESSION['dol_login']=".$_SESSION["dol_login"].", ".ini_get("session.gc_maxlifetime"));
|
2008-10-12 13:41:13 +02:00
|
|
|
|
2006-12-13 20:15:43 +01:00
|
|
|
session_unregister("dol_login");
|
2004-07-27 16:56:03 +02:00
|
|
|
|
2009-04-27 22:37:50 +02:00
|
|
|
// Destroy entity cookie
|
|
|
|
|
if ($conf->multicompany->enabled)
|
|
|
|
|
{
|
|
|
|
|
$entityCookieName = "DOLENTITYID_dolibarr";
|
|
|
|
|
setcookie($entityCookieName, '', 1, "/");
|
|
|
|
|
}
|
2008-12-10 15:56:05 +01:00
|
|
|
|
|
|
|
|
// Define url to go
|
|
|
|
|
$url=DOL_URL_ROOT."/index.php"; // By default go to login page
|
2009-04-17 20:35:16 +02:00
|
|
|
if ($urlfrom)
|
2008-12-10 15:56:05 +01:00
|
|
|
{
|
|
|
|
|
$url=DOL_URL_ROOT.$urlfrom;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
header("Location: ".$url);
|
2003-08-30 11:27:49 +02:00
|
|
|
?>
|