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
40 lines (35 loc) · 1.03 KB
/
Copy pathindex.php
File metadata and controls
40 lines (35 loc) · 1.03 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
40
<?php
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
verify_csrf($_GET);
if ($_GET['type'] == 'access') {
$type = 'access';
}
if ($_GET['type'] == 'error') {
$type = 'error';
}
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=".$_GET['domain'].".".$type."-log.txt");
header("Content-Type: application/octet-stream; ");
header("Content-Transfer-Encoding: binary");
$v_domain = $_GET['domain'];
if ($_GET['type'] == 'access') {
$type = 'access';
}
if ($_GET['type'] == 'error') {
$type = 'error';
}
$cmd = implode(" ", array(
escapeshellarg(HESTIA_CMD . "v-list-web-domain-" . $type . "log"),
// $user is already shell-escaped
$user,
escapeshellarg($v_domain),
"5000",
));
passthru($cmd, $return_var);
if ($return_var != 0) {
$errstr = "Internal server error: command returned non-zero: {$return_var}: {$cmd}";
echo $errstr;
throw new Exception($errstr); // make sure it ends up in an errorlog somewhere
}