| 1 |
<?php |
| 2 |
/* |
| 3 |
|
| 4 |
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) |
| 5 |
Copyright (C) 2003 - 2024 Roland Gruber |
| 6 |
|
| 7 |
This program is free software; you can redistribute it and/or modify |
| 8 |
it under the terms of the GNU General Public License as published by |
| 9 |
the Free Software Foundation; either version 2 of the License, or |
| 10 |
(at your option) any later version. |
| 11 |
|
| 12 |
This program is distributed in the hope that it will be useful, |
| 13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
GNU General Public License for more details. |
| 16 |
|
| 17 |
You should have received a copy of the GNU General Public License |
| 18 |
along with this program; if not, write to the Free Software |
| 19 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 |
|
| 21 |
*/ |
| 22 |
|
| 23 |
/** |
| 24 |
* User is logged off from LDAP server, session is destroyed. |
| 25 |
* |
| 26 |
* @package main |
| 27 |
* @author Roland Gruber |
| 28 |
*/ |
| 29 |
|
| 30 |
|
| 31 |
/** security functions */ |
| 32 |
include_once(__DIR__ . "/../lib/security.inc"); |
| 33 |
/** Used to display status messages */ |
| 34 |
include_once(__DIR__ . "/../lib/status.inc"); |
| 35 |
/** LDAP settings are deleted at logout */ |
| 36 |
include_once(__DIR__ . "/../lib/ldap.inc"); |
| 37 |
|
| 38 |
// delete key and iv in cookie |
| 39 |
$cookieOptions = lamDefaultCookieOptions(); |
| 40 |
$cookieOptions['expires'] = 0; |
| 41 |
setcookie("Key", "", $cookieOptions); |
| 42 |
setcookie("IV", "", $cookieOptions); |
| 43 |
|
| 44 |
// start session |
| 45 |
startSecureSession(); |
| 46 |
|
| 47 |
// log message |
| 48 |
if (isset($_SESSION['loggedIn']) || ($_SESSION['loggedIn'] === true)) { |
| 49 |
logNewMessage(LOG_NOTICE, 'User logged off.'); |
| 50 |
|
| 51 |
// close LDAP connection |
| 52 |
if (!empty($_SESSION["ldap"])) { |
| 53 |
$_SESSION["ldap"]->destroy(); |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
// clean temporary files |
| 58 |
$temporaryFilesManager = new LamTemporaryFilesManager(); |
| 59 |
$temporaryFilesManager->deleteAllRegisteredFiles(); |
| 60 |
|
| 61 |
setlanguage(); |
| 62 |
|
| 63 |
// destroy session |
| 64 |
session_destroy(); |
| 65 |
unset($_SESSION); |
| 66 |
|
| 67 |
// redirect to login page |
| 68 |
metaRefresh('login.php'); |