-
Notifications
You must be signed in to change notification settings - Fork 0
/
sec_data.php
46 lines (30 loc) · 1.1 KB
/
sec_data.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
<?php
header("Content-Type: text/html; charset=utf-8");
include 'conf/env_router.php';
$conf = Conf::getActive();
if (!(isset($_SERVER['HTTPS']) && 'on' == $_SERVER['HTTPS']) && !isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
die("Diese Seite darf nur über https aufgerufen werden");
}
$dataReader = new SettingDataReader('users');
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="Preview Mode"');
header('HTTP/1.0 401 Unauthorized');
echo 'Zugriff nur mit Passwort';
exit;
} else {
if (!$dataReader->getVal('users',$_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="Preview Mode"');
header('HTTP/1.0 401 Unauthorized');
echo 'Zugriff nur mit Passwort';
exit;
}
if ( $dataReader->getVal('users',$_SERVER['PHP_AUTH_USER']) !== sha1($_SERVER['PHP_AUTH_PW']) ){
header('WWW-Authenticate: Basic realm="Preview Mode"');
header('HTTP/1.0 401 Unauthorized');
echo 'Zugriff nur mit Passwort';
exit;
}
}
$encrypted = $_GET['val'];
$decrypter = new UtilEncrypt();
echo $decrypter->decrypt($encrypted,$conf->crypt_pwd);