Dateien nach "/" hochladen

This commit is contained in:
M_Viper 2024-03-10 15:21:10 +00:00
parent f8c282ea84
commit 5e313df2ec
5 changed files with 1416 additions and 0 deletions

BIN
1.8.1.zip Normal file

Binary file not shown.

70
auth.php Normal file
View File

@ -0,0 +1,70 @@
<?php
session_start();
// Benutzerdatenbank
$valid_users = array(
'admin' => array(
'password' => 'Jennifer@1996+',
'access_level' => 'all'
),
'Lager' => array(
'password' => 'MediaMarkt',
'access_level' => 'limited'
)
);
function authenticate($username, $password) {
global $valid_users;
if (array_key_exists($username, $valid_users) && $valid_users[$username]['password'] === $password) {
$_SESSION['authenticated'] = true;
$_SESSION['username'] = $username;
$_SESSION['access_level'] = $valid_users[$username]['access_level'];
$_SESSION['last_activity'] = time(); // Zeitstempel für die letzte Aktion setzen
// Weiterleitung basierend auf der Benutzerrolle
if ($_SESSION['access_level'] === 'all') {
header('Location: public/admin.php');
exit;
} elseif ($_SESSION['access_level'] === 'limited') {
header('Location: public/search.php');
exit;
}
return true;
} else {
return false;
}
}
function is_authenticated() {
return isset($_SESSION['authenticated']) && $_SESSION['authenticated'] === true;
}
function require_login() {
if (!is_authenticated()) {
header('Location: public/search.php');
exit;
}
}
function require_admin_login() {
require_login();
if ($_SESSION['access_level'] !== 'all') {
header('Location: unauthorized.php');
exit;
}
}
function require_limited_access_login() {
require_login();
if ($_SESSION['access_level'] !== 'limited') {
header('Location: unauthorized.php');
exit;
}
}
function get_authenticated_username() {
return $_SESSION['username'] ?? null;
}
?>

7
composer.json Normal file
View File

@ -0,0 +1,7 @@
{
"require": {
"picqer/php-barcode-generator": "^2.4",
"phpoffice/phpspreadsheet": "^2.0",
"tecnickcom/tcpdf": "^6.6"
}
}

1334
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

5
index.php Normal file
View File

@ -0,0 +1,5 @@
<?php
// Weiterleitung zur search.php-Datei
header("Location: /Logistik/public/search.php");
exit;
?>