forked from nilsteampassnet/TeamPass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogout.php
42 lines (37 loc) · 1.1 KB
/
logout.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
*
* @file logout.php
* @author Nils Laumaillé
* @version 2.1.26
* @copyright (c) 2009-2016 Nils Laumaillé
* @licensing GNU AFFERO GPL 3.0
* @link http://www.teampass.net
*
* This library 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.
*/
session_start();
// Update table by deleting ID
if (isset($_SESSION['user_id']) && !empty($_SESSION['user_id'])) {
DB::update(
prefix_table("users"),
array(
'key_tempo' => '',
'timestamp' => '',
'session_end' => ''
),
"id=%i",
$_SESSION['user_id']
);
//Log into DB the user's disconnection
if (isset($_SESSION['settings']['log_connections']) && $_SESSION['settings']['log_connections'] == 1) {
logEvents('user_connection', 'disconnection', @$_SESSION['user_id'], $_SESSION['login']);
}
}
// erase session table
$_SESSION = array();
// Kill session
session_destroy();
header("Location: index.php");