Passed
Push — development ( 5845ec...b898aa )
by Nils
03:32
created

logout.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 *
4
 * @package       logout.php
5
 * @author        Nils Laumaillé <[email protected]>
6
 * @version       2.1.27
7
 * @copyright     2009-2018 Nils Laumaillé
8
 * @license       GNU GPL-3.0
9
 * @link          https://www.teampass.net
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 */
15
16
17
require_once 'sources/SecureHandler.php';
18
session_start();
19
20
// Update table by deleting ID
21
if (isset($_SESSION['user_id']) && empty($_SESSION['user_id']) === false) {
22
    $user_id = $_SESSION['user_id'];
23
} elseif (isset($_GET['user_id']) && empty($_GET['user_id']) === false) {
24
    $user_id = $_GET['user_id'];
25
} else {
26
    $user_id = "";
27
}
28
29
if (empty($user_id) === false && isset($_SESSION['CPM']) === true) {
30
    // connect to the server
31
    require_once './sources/main.functions.php';
32
    require_once './includes/config/settings.php';
33
    require_once './includes/libraries/Database/Meekrodb/db.class.php';
34
    $pass = defuse_return_decrypted($pass);
35
    DB::$host = $server;
0 ignored issues
show
The type DB was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
36
    DB::$user = $user;
37
    DB::$password = $pass;
38
    DB::$dbName = $database;
39
    DB::$port = $port;
40
    DB::$encoding = $encoding;
41
    DB::$error_handler = true;
42
    $link = mysqli_connect($server, $user, $pass, $database, $port);
43
    $link->set_charset($encoding);
44
45
    // clear in db
46
    DB::update(
47
        $pre."users",
48
        array(
49
            'key_tempo' => '',
50
            'timestamp' => '',
51
            'session_end' => ''
52
        ),
53
        "id=%i",
54
        $user_id
55
    );
56
    //Log into DB the user's disconnection
57
    if (isset($_SESSION['settings']['log_connections']) && $_SESSION['settings']['log_connections'] == 1) {
58
        require_once 'sources/main.functions.php';
59
        logEvents('user_connection', 'disconnection', $user_id, @$_SESSION['login']);
60
    }
61
}
62
63
// erase session table
64
session_unset();
65
session_destroy();
66
$_SESSION = array();
67
68
echo '
69
    <script language="javascript" type="text/javascript">
70
    <!--
71
        sessionStorage.clear();
72
        setTimeout(function(){document.location.href="index.php"}, 1);
73
    -->
74
    </script>';
75