Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         logout
6
 * @author          Ryan Djurovich, WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @link            http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id: index.php 2 2017-07-02 15:14:29Z Manuela $
13
 * @filesource        $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/branches/main/admin/logout/index.php $
14
 * @lastmodified    $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
15
 *
16
 */
17

    
18
require('../../config.php');
19

    
20
// delete remember key of current user from database
21
if (isset($_SESSION['USER_ID']) && isset($database)) {
22
    $table = TABLE_PREFIX . 'users';
23
    $sql = "UPDATE `$table` SET `remember_key` = '' WHERE `user_id` = '" . (int) $_SESSION['USER_ID'] . "'";
24
    $database->query($sql);
25
}
26

    
27
// delete remember key cookie if set
28
if (isset($_COOKIE['REMEMBER_KEY'])) {
29
    setcookie('REMEMBER_KEY', '', time() - 3600, '/');
30
}
31

    
32
// delete most critical session variables manually
33
$_SESSION['USER_ID'] = null;
34
$_SESSION['GROUP_ID'] = null;
35
$_SESSION['GROUPS_ID'] = null;
36
$_SESSION['USERNAME'] = null;
37
$_SESSION['PAGE_PERMISSIONS'] = null;
38
$_SESSION['SYSTEM_PERMISSIONS'] = null;
39

    
40
// overwrite session array
41
$_SESSION = array();
42

    
43
// delete session cookie if set
44
if (isset($_COOKIE[session_name()])) {
45
    setcookie(session_name(), '', time() - 42000, '/');
46
}
47

    
48
// delete the session itself
49
session_destroy();
50

    
51
// redirect to admin login
52
die(header('Location: ' . ADMIN_URL . '/login/index.php'));
53

    
54
?>
    (1-1/1)