-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfile.php
More file actions
48 lines (32 loc) · 1.01 KB
/
file.php
File metadata and controls
48 lines (32 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
40
41
42
43
44
<?php
include 'conf/env_router.php';
$conf = Conf::getActive();
if (!isset($_SESSION['user_knows_pwd'])) {
if($conf->preview_sec){
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="Please enter the passcode. User: "'.$conf->watch_user);
header('HTTP/1.0 401 Unauthorized');
echo 'Zugriff nur mit Passwort';
exit;
} else {
if ( $conf->watch_word !== $_SERVER['PHP_AUTH_PW'] ){
header('WWW-Authenticate: Basic realm="Please enter the passcode. User: "'.$conf->watch_user);
header('HTTP/1.0 401 Unauthorized');
echo 'Zugriff nur mit Passwort';
exit;
} else {
$_SESSION['user_knows_pwd'] = true;
}
}
} else {
header('Location: '.$conf->watch_login);
exit();
}
}
$filename = str_replace('../','./',$_GET['f']);
if (file_exists('./secure/'.$filename.'.pdf')) {
header('Content-type: application/pdf');
readfile('./secure/'.$filename.'.pdf');
} else {
echo '<p>File not exists.</p>';
}