Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         logout
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id: index.php 1386 2011-01-16 09:56:53Z Luisehahne $
14
 * @filesource		$HeadURL: http://svn.websitebaker2.org/branches/2.8.x/wb/admin/users/save.php $
15
 * @lastmodified    $Date: 2011-01-10 13:21:47 +0100 (Mo, 10. Jan 2011) $
16
 *
17
 */
18

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

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

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

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

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

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

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

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

    
55
?>
    (1-1/1)