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 2098 2014-02-11 01:37:03Z darkviper $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/logout/index.php $
14
 * @lastmodified    $Date: 2014-02-11 02:37:03 +0100 (Tue, 11 Feb 2014) $
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
    $oDb = WbDatabase::getInstance();
24
	$sql = 'UPDATE `'.$oDb->TablePrefix.'users` '
25
         . 'SET `remember_key`=\'\' '
26
         . 'WHERE `user_id`='.(int)$_SESSION['USER_ID'];
27
	$oDb->doQuery($sql);
28
}
29

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

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

    
43
// overwrite session array
44
$_SESSION = array();
45

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

    
51
// delete the session itself
52
session_destroy();
53

    
54
// redirect to admin login
55
die(header('Location: ' . ADMIN_URL . '/login/index.php'));
56

    
57
?>
    (1-1/1)