forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
39 lines (37 loc) · 1.01 KB
/
index.php
File metadata and controls
39 lines (37 loc) · 1.01 KB
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
<?php
use function Hestiacp\quoteshellarg\quoteshellarg;
// Main include
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
// Check token
verify_csrf($_GET);
if (!empty($_SESSION["look"])) {
$v_user = quoteshellarg($_SESSION["look"]);
$v_impersonator = quoteshellarg($_SESSION["user"]);
exec(
HESTIA_CMD .
"v-log-action system 'Warning' 'Security' 'User impersonation session ended (User: $v_user, Administrator: $v_impersonator)'",
$output,
$return_var,
);
unset($_SESSION["look"]);
# Remove current path for filemanager
unset($_SESSION["_sf2_attributes"]);
unset($_SESSION["_sf2_meta"]);
header("Location: /");
} else {
if ($_SESSION["token"] && $_SESSION["user"]) {
unset($_SESSION["userTheme"]);
$v_user = quoteshellarg($_SESSION["user"]);
$v_session_id = quoteshellarg($_SESSION["token"]);
exec(
HESTIA_CMD . "v-log-user-logout " . $v_user . " " . $v_session_id,
$output,
$return_var,
);
}
unset($_SESSION);
session_unset();
session_destroy();
header("Location: /login/");
}
exit();