40 Commits
Author SHA1 Message Date
Tower a23788ba7c Merge branch 'Controller' into Services 2026-01-22 11:31:47 +01:00
Tower 8585af5cfe update: auth 2026-01-21 21:21:54 +01:00
Tower 56e3ea9fca Update: CheckUser Credentials for Login 2026-01-21 18:35:22 +01:00
Tower 8e722086ac delete unused print 2026-01-21 14:06:10 +01:00
Tower ae7b2bbc6e test function 2026-01-21 14:03:15 +01:00
Tower dd77ede0a5 delete unused function 2026-01-21 13:54:09 +01:00
Tower fb199dd807 Merge branch 'Dev-TEST'
# Conflicts:
#	WEBROOT/services/test.php
2026-01-21 12:40:45 +01:00
Tower 2674a6d8ff Test for Kalender upgrade with months 2026-01-21 12:38:37 +01:00
Tower 8883b5c7c5 change text 2026-01-21 12:32:23 +01:00
Tower 38e8c51960 delete something 2026-01-21 12:31:30 +01:00
Tower 31266410cc testing 2026-01-21 12:30:58 +01:00
worker ea8fc5e27a fix: other csv download name by filter name 2026-01-21 09:42:38 +01:00
worker a7fbf7c0f7 hotfix 2026-01-21 08:36:17 +01:00
worker 875e4eba03 feat: export as CSV 2026-01-21 08:31:49 +01:00
worker a95b6788c5 new default filter is today 2026-01-21 07:59:22 +01:00
Tower d87324165b hotfix order by datum and new filter 2026-01-20 20:10:51 +01:00
Tower eba7c76f6f update: test 2026-01-20 19:43:17 +01:00
Tower 0ae458f5b4 feat: new Calender mit dates 2026-01-20 19:43:02 +01:00
Tower 563c7e8d6f update: DatabaseConnect 2026-01-20 19:42:05 +01:00
worker 039ee32374 Kalender und USerController hotfix 2026-01-20 16:19:12 +01:00
worker 14f28e4525 UserController, new Stundenplan for Bruno and tests fÃor Login with Database for permission controll 2026-01-20 15:02:40 +01:00
worker df545d339a fix 2026-01-20 12:59:55 +01:00
Bruno b2a18bab7a test commit 2026-01-14 12:28:09 +01:00
bruno a8d21c08f4 Update: Dashboards activity status change 2026-01-13 18:21:01 +01:00
bruno 907e6f832b Work: new Stundenplan 2026-01-13 18:20:20 +01:00
Bruno 752b91fd7f GIT-MGMT NEW 2026-01-12 14:45:15 +01:00
bruno e5605a6327 Update: DatabaseConnect 2026-01-12 14:01:04 +01:00
hydrax 24f57ec757 Update: Berichtshefte ready for live 2026-01-08 18:57:09 +01:00
Bruno Eckhardt dac39e7608 Update: new README.md 2026-01-07 19:35:11 +01:00
Bruno Eckhardt 2030673801 Update: Test.php ready for live but no css 2026-01-07 19:34:34 +01:00
hydrax deff804f2c Test for Berichtsheft Berufsschule 2026-01-07 18:06:30 +01:00
hydrax e66bf1a34b Dropdown tests with json encode 2026-01-07 09:53:44 +01:00
hydrax 6af4f8fbdd Update: Readme.md, Controller etc. 2026-01-06 14:25:14 +01:00
Bruno a0a60cdd79 fixes from test.php 2026-01-06 10:32:58 +01:00
Bruno Eckhardt 148ae40783 Update: extension for normalization in DatabaseController and new test.php 2026-01-05 23:30:31 +01:00
hydrax eeda9e37cb Update: DataController better Performance and secure 2026-01-05 18:31:11 +01:00
hydrax 0ac317108a Update: Referer URL, Update: Template for test.php 2026-01-05 11:14:23 +01:00
hydrax d573146f84 fix: Controller update mit CRUD 2026-01-05 10:13:57 +01:00
Bruno Eckhardt 57503b2c6d fix: rename DebugLog function to ConsoleLog 2026-01-04 20:16:51 +01:00
Bruno Eckhardt b5e05a8ca2 update; New DatabaseController with CRUD Architecture and updated LogController, new test.php 2026-01-04 16:50:56 +01:00
25 changed files with 1146 additions and 529 deletions

No files matched your search

+3 -4
View File
@@ -1,4 +1,3 @@
*.db
WEBROOT/sitemap.xml
WEBROOT/sitemap.xml
PUBLIC.code-workspace
*.db
WEBROOT/sitemap.xml
WEBROOT/sitemap.xml
+46
View File
@@ -0,0 +1,46 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"workbench.colorTheme": "Catppuccin Macchiato",
"workbench.colorCustomizations": {
"activityBar.background": "#00aeff75",
"activityBar.foreground": "#000000",
"breadcrumb.foreground": "#FFFFFF",
},
"editor.renderWhitespace": "all",
"editor.smoothScrolling": true,
"editor.fontSize": 14,
"editor.formatOnSave": true,
"editor.minimap.enabled": true,
"editor.minimap.scale": 2,
"editor.minimap.side": "right",
"editor.minimap.maxColumn": 100,
"editor.minimap.renderCharacters": true,
"editor.minimap.showSlider": "always",
"files.autoSave": "off",
"files.autoSaveDelay": 3000,
"window.title": "PUBLIC",
"workbench.editor.wrapTabs": true,
},
"extensions": {
"recommendations": [
"oderwat.indent-rainbow",
"pranaygp.vscode-css-peek",
"wayou.vscode-todo-highlight",
"mrmlnc.vscode-mustache",
"fabiospampinato.vscode-highlight",
"junstyle.php-cs-fixer",
"mtea.gettext-editor",
"neilbrayfield.php-docblocker",
"bmewburn.vscode-intelephense-client",
"mohamed-ali.html-css-class-completion",
"rifi2k.format-html-in-php",
"mrorz.language-gettext",
"voldemortensen.rainbow-tags",
]
}
}
+50
View File
@@ -0,0 +1,50 @@
Use Cases:
# DatabaseController:
DatabaseShowWithFK(
"tabelle",
$fkMap,
"spaltenname1, spaltenname2, spaltenname3",
"spalte = ?",
$var1 // wer für spalte
);
DatabaseShowWithFK(
"Berufsschulberichte",
$fkMap
);
DatabaseShow(
"tabelle",
"spaltenname1, spaltenname2, spaltenname3"
"spalte = ?",
$var1 // wert für spalte
);
DatabaseShow(
"tabelle",
);
DatabaseInsert(
"tabelle",
"spaltenname1, spaltenname2, spaltenname3",
$var1,
$var2,
$var3
);
DatabaseDelete(
"tabelle",
"spalte = ?",
$var1 // wert für spalte
);
DatabaseUpdate(
"tabelle",
"username = ?, email = ?",
"id = ?",
"NeuerName",
"neu@mail.de",
$var1 // wert für id
);
+76 -50
View File
@@ -2,10 +2,6 @@
class getSpecificData {
public function getServerIP(): string {
return $_SERVER['SERVER_ADDR'] ?? 'Unbekannt';
}
public function getUserAgent(): string {
return $_SERVER['HTTP_USER_AGENT'] ?? 'Unbekannt';
}
@@ -37,19 +33,11 @@ class getSpecificData {
public function getDocumentRoot(): string {
return $_SERVER['DOCUMENT_ROOT'] ?? 'Unbekannt';
}
public function getRequestTimeFloat(): string {
return $_SERVER['REQUEST_TIME_FLOAT'] ?? 'Unbekannt';
}
public function getQuery(): string {
return $_SERVER['QUERY_STRING'] ?? 'Unbekannt';
}
public function getServerName(): string {
return $_SERVER['SERVER_NAME'] ?? 'Unbekannt';
}
public function getRequestMethod(): string {
return $_SERVER['REQUEST_METHOD'] ?? 'Unbekannt';
}
@@ -58,11 +46,35 @@ class getSpecificData {
return __DIR__ ;
}
public function getReferer(): string {
return $_SERVER['HTTP_REFERER'] ?? 'Unbekannt';
}
public function getDatabase(): string {
$conn = db_connect();
return $conn->host_info;
}
public function getServerName(): string {
$Servername = $_SERVER['SERVER_NAME'] ?? 'Unbekannt';
if (in_array($Servername, ['Unbekannt', '0.0.0.0', '127.0.0.1'])) {
return "Lokal";
} else {
return $Servername;
}
}
public function getServerIP(): string {
$ServerIP = $_SERVER['SERVER_ADDR'] ?? 'Unbekannt';
if (in_array($ServerIP, ['Unbekannt', '0.0.0.0', '127.0.0.1'])) {
return "Lokal";
} else {
return $ServerIP;
}
}
public function getClientIP(): string {
$xff = $_SERVER['HTTP_X_FORWARDED_FOR'] ?? null;
@@ -82,23 +94,29 @@ class getSpecificData {
}
function getGeoIP($ClientIP) {
$response = file_get_contents("http://ip-api.com/json/{$ClientIP}?fields=country,countryCode");
$data = json_decode($response);
return $data->country;
$whitelist = (new getSpecificData())->getWhitelistedIPs();
if (in_array($ClientIP, $whitelist)) {
return "Lokal";
} else {
$response = file_get_contents("http://ip-api.com/json/{$ClientIP}?fields=country,countryCode");
$data = json_decode($response);
return $data->country;
}
}
function getWhitelistedIPs() {
$conn = db_connect();
$ips="SELECT `IP-ADDRESSE` FROM Whitelisted";
$results = $conn->query($ips);
include_once 'DatabaseController.php';
$data = DatabaseShow(
"Whitelisted",
"`IP-ADDRESSE`"
);
$WhitelistedIPs = [];
if ($results && $results->num_rows > 0) {
while ($row = $results->fetch_assoc()) {
$WhitelistedIPs[] = $row['IP-ADDRESSE'];
}
$results = [];
foreach ($data as $row) {
$results[] =$row['IP-ADDRESSE'];
}
return $WhitelistedIPs;
return $results;
}
function getServerNode($ServerIP) {
@@ -107,11 +125,11 @@ class getSpecificData {
'node2' => '172.30.0.12',
'node3' => '172.30.0.13',
'node4' => '172.30.0.14',
'Lokal' => 'Lokal',
];
foreach ($nodes as $node => $ip) {
if ($ServerIP == $ip) {
// $ServerIP = $node;
return $node;
break;
}
@@ -125,38 +143,46 @@ class getSpecificData {
return "Untrusted";
}
function test() {
return "TEST";
}
public function getAllData(): array {
return [
'Document-Root' => $this->getDocumentRoot(),
'CurrentDir' => $this->getCurrentDir(),
'SERVER-IP' => $this->getServerIP(),
'Node' => $this->getServerNode($this->getServerIP()),
'Server-Port' => $this->getServerPort(),
'Server-Name' => $this->getServerName(),
'Client-IP' => $this->getClientIP(),
'Client-Port' => $this->getClientPort(),
'User-Agent' => $this->getUserAgent(),
'Request URL' => $this->getRequestURL(),
'Cookie' => $this->getCookie('USER'),
'Server Cookie' => $this->getCookie('SESSSRV'),
'Session' => $this->getSessionID(),
'Query' => $this->getQuery(),
'Request-Method' => $this->getRequestMethod(),
'Request-Time' => $this->getRequestTime(),
'Unix-timestamp' => $this->getRequestTimeFloat(),
'Land' => $this->getGeoIP($this->getClientIP()),
'Database' => $this->getDatabase(),
'Whitelisted Status' => $this->getClientStatus($this->getClientIP()),
'Whitelisted IPs' => $this->getWhitelistedIPs(),
'Document-Root' => $this->getDocumentRoot(),
'CurrentDir' => $this->getCurrentDir(),
'Referer' => $this->getReferer(),
'Request URL' => $this->getRequestURL(),
'Server-Port' => $this->getServerPort(),
'Server-IP' => $this->getServerIP(),
'Server-Name' => $this->getServerName(),
'Server-Node' => $this->getServerNode($this->getServerIP()),
'Client-IP' => $this->getClientIP(),
'Client-Port' => $this->getClientPort(),
'Client-Land' => $this->getGeoIP($this->getClientIP()),
'Client-User-Agent' => $this->getUserAgent(),
'Client-Cookie' => $this->getCookie('USER'),
'Client-Server-Cookie' => $this->getCookie('SESSSRV'),
'Client-Session-ID' => $this->getSessionID(),
'Query' => $this->getQuery(),
'Request-Method' => $this->getRequestMethod(),
'Request-Time' => $this->getRequestTime(),
'Database' => $this->getDatabase(),
'Whitelisted Status' => $this->getClientStatus($this->getClientIP()),
'Whitelisted IPs' => $this->getWhitelistedIPs(),
];
}
public function ShowAllData(): void {
$SpecificData = (new getSpecificData())->getAllData();
echo "<pre>";
print_r($SpecificData);
foreach ($SpecificData as $key => $value) {
if (is_array($value)) {
$value = implode(', ', $value);
}
printf("%-22s : %s\n", $key, $value);
}
echo "</pre>";
}
}
// $ShowAllDAta = (new getSpecificData())->ShowAllData();
}
+27 -12
View File
@@ -1,25 +1,40 @@
<?php
function db_connect() {
$local = false;
$servers = [
'remote' => '10.233.1.244',
'local' => '100.123.136.86'
'dev' => [
'hostaddr' => '10.233.1.29',
'username' => 'worker',
'password' => 'bBHofurUJWKzPE8Z',
'database' => 'DEV',
],
'vpn' => [
'hostaddr' => '100.123.136.86',
'username' => 'worker',
'password' => 'bBHofurUJWKzPE8Z',
'database' => 'DEV',
],
'live' => [
'hostaddr' => '10.233.1.244',
'username' => 'worker',
'password' => 'bBHofurUJWKzPE8Z',
'database' => 'DEV',
]
];
$username = "worker";
$password = "bBHofurUJWKzPE8Z";
$dbname = "DEV";
$enviroment = 'live';
$host = $local ? $servers['local'] : $servers['remote'];
$conn = new mysqli($host, $username, $password, $dbname);
$conn = new mysqli(
$servers[$enviroment]['hostaddr'],
$servers[$enviroment]['username'],
$servers[$enviroment]['password'],
$servers[$enviroment]['database'],
);
if ($conn->connect_error) {
throw new Exception("Datenbankverbindung fehlgeschlagen: " . $conn->connect_error);
throw new Exception('Connection Error: ' . $conn->connect_error);
}
$conn->set_charset("utf8mb4");
return $conn;
}
+177 -26
View File
@@ -1,26 +1,177 @@
<?php
function DatabaseInsert($table, $columns, ...$values) {
include_once 'DatabaseConnect.php';
$conn = db_connect();
$placeholders = rtrim(str_repeat("?,", count($values)), ",");
$sql = "INSERT INTO `$table` ($columns) VALUES ($placeholders)";
$stmt = $conn->prepare($sql);
if (!$stmt) {
die("Fehler beim Prepare: " . $conn->error);
}
if (!$stmt->execute($values)) {
die("Fehler beim Execute: " . $stmt->error);
}
return true;
}
function DatabaseDelete() {
}
function DatabaseUpdate() {
}
<?php
function DatabaseShow($table, $columns = "*", $where = "", ...$values) {
include_once 'DatabaseConnect.php';
$conn = db_connect();
$sql = "SELECT $columns FROM `$table`";
if (!empty($where)) {
$sql .= " WHERE $where";
}
$stmt = $conn->prepare($sql);
if (!$stmt) {
die("Fehler beim Prepare: " . $conn->error);
}
if (!$stmt->execute($values)) {
die("Fehler beim Execute: " . $stmt->error);
}
$result = $stmt->get_result();
return $result->fetch_all(MYSQLI_ASSOC);
}
function DatabaseInsert($table, $columns, ...$values) {
include_once 'DatabaseConnect.php';
$conn = db_connect();
$placeholders = rtrim(str_repeat("?,", count($values)), ",");
$sql = "INSERT INTO `$table` ($columns) VALUES ($placeholders)";
$stmt = $conn->prepare($sql);
if (!$stmt) {
die("Fehler beim Prepare: " . $conn->error);
}
if (!$stmt->execute($values)) {
die("Fehler beim Execute: " . $stmt->error);
}
return true;
}
function DatabaseDelete($table, $where, ...$values) {
include_once 'DatabaseConnect.php';
$conn = db_connect();
$sql = "DELETE FROM `$table` WHERE $where";
$stmt = $conn->prepare($sql);
if (!$stmt) {
die("Fehler beim Prepare: " . $conn->error);
}
if (!$stmt->execute($values)) {
die("Fehler beim Execute: " . $stmt->error);
}
return true;
}
function DatabaseUpdate($table, $set, $where, ...$values) {
include_once 'DatabaseConnect.php';
$conn = db_connect();
$sql = "UPDATE `$table` SET $set WHERE $where";
$stmt = $conn->prepare($sql);
if (!$stmt) {
die("Fehler beim Prepare: " . $conn->error);
}
if (!$stmt->execute($values)) {
die("Fehler beim Execute: " . $stmt->error);
}
return true;
}
function DatabaseShowWithFK($table, $fkMap = [], $columns = "*", $where = "", ...$values) {
include_once 'DatabaseConnect.php';
$conn = db_connect();
$select = is_array($columns) ? implode(", ", $columns) : $columns;
$sql = "SELECT $select FROM `$table`";
if (!empty($where)) {
$sql .= " WHERE $where";
}
$stmt = $conn->prepare($sql);
if (!$stmt) die("Fehler beim Prepare: " . $conn->error);
if (!$stmt->execute($values)) die("Fehler beim Execute: " . $stmt->error);
$result = $stmt->get_result();
if (!$result) die("Fehler beim get_result: " . $stmt->error);
$columnsResult = [];
while ($fieldinfo = $result->fetch_field()) {
$columnsResult[] = $fieldinfo->name;
}
$rows = $result->fetch_all(MYSQLI_ASSOC);
foreach ($rows as &$row) {
foreach ($fkMap as $fkColumn => $fkInfo) {
if (isset($row[$fkColumn]) && $row[$fkColumn] !== null) {
$fkStmt = $conn->prepare(
"SELECT {$fkInfo['value']} FROM `{$fkInfo['table']}` WHERE {$fkInfo['key']} = ?"
);
if (!$fkStmt) die("Fehler beim Prepare FK: " . $conn->error);
$fkStmt->bind_param("i", $row[$fkColumn]);
$fkStmt->execute();
$fkResult = $fkStmt->get_result();
$fkRow = $fkResult->fetch_assoc();
$row[$fkColumn] = $fkRow ? $fkRow[$fkInfo['value']] : null;
}
}
}
return [
"rows" => $rows
];
}
$Berufsschulberichte = [
"FACH_S1" => ["table" => "Fach", "key" => "ID", "value" => "Fach"],
"LEHRER_S1" => ["table" => "Lehrer", "key" => "ID", "value" => "NAME"],
"RAUM_S1" => ["table" => "Raum", "key" => "ID", "value" => "Raum_NR"],
"FACH_S2" => ["table" => "Fach", "key" => "ID", "value" => "Fach"],
"LEHRER_S2" => ["table" => "Lehrer", "key" => "ID", "value" => "NAME"],
"RAUM_S2" => ["table" => "Raum", "key" => "ID", "value" => "Raum_NR"],
"FACH_S3" => ["table" => "Fach", "key" => "ID", "value" => "Fach"],
"LEHRER_S3" => ["table" => "Lehrer", "key" => "ID", "value" => "NAME"],
"RAUM_S3" => ["table" => "Raum", "key" => "ID", "value" => "Raum_NR"],
"FACH_S4" => ["table" => "Fach", "key" => "ID", "value" => "Fach"],
"LEHRER_S4" => ["table" => "Lehrer", "key" => "ID", "value" => "NAME"],
"RAUM_S4" => ["table" => "Raum", "key" => "ID", "value" => "Raum_NR"],
"FACH_S5" => ["table" => "Fach", "key" => "ID", "value" => "Fach"],
"LEHRER_S5" => ["table" => "Lehrer", "key" => "ID", "value" => "NAME"],
"RAUM_S5" => ["table" => "Raum", "key" => "ID", "value" => "Raum_NR"],
"FACH_S6" => ["table" => "Fach", "key" => "ID", "value" => "Fach"],
"LEHRER_S6" => ["table" => "Lehrer", "key" => "ID", "value" => "NAME"],
"RAUM_S6" => ["table" => "Raum", "key" => "ID", "value" => "Raum_NR"],
"FACH_S7" => ["table" => "Fach", "key" => "ID", "value" => "Fach"],
"LEHRER_S7" => ["table" => "Lehrer", "key" => "ID", "value" => "NAME"],
"RAUM_S7" => ["table" => "Raum", "key" => "ID", "value" => "Raum_NR"],
"FACH_S8" => ["table" => "Fach", "key" => "ID", "value" => "Fach"],
"LEHRER_S8" => ["table" => "Lehrer", "key" => "ID", "value" => "NAME"],
"RAUM_S8" => ["table" => "Raum", "key" => "ID", "value" => "Raum_NR"],
];
$Stundenplan = [
"MO" => ["table" => "Fach", "key" => "ID", "value" => "Fach"],
"DI" => ["table" => "Fach", "key" => "ID", "value" => "Fach"],
"MI" => ["table" => "Fach", "key" => "ID", "value" => "Fach"],
"DO" => ["table" => "Fach", "key" => "ID", "value" => "Fach"],
"FR" => ["table" => "Fach", "key" => "ID", "value" => "Fach"],
];
$Berechtigungen = [
"BENUTZER_ID" => ["table" => "Benutzer", "key" => "ID", "value" => "ID"],
"BERECHTIGUNGEN_ID" => ["table" => "Berechtigungen", "key" => "ID", "value" => "ID"]
];
-22
View File
@@ -61,28 +61,6 @@ function logging() {
");
$updateCookieValue->bind_param("sss", $USERCOOKIE, $ClientIP, $RequestURL);
$updateCookieValue->execute();
// $updateServerIP = $db_conn->prepare("
// UPDATE logs
// SET `SERVER-IP` = ?
// WHERE `CLIENT-IP` = ?
// AND `REQUEST-URL` = ?
// AND `SERVER-IP` IS NULL
// ");
// $updateServerIP->bind_param("sss", $ServerIP, $ClientIP, $RequestURL);
// $updateServerIP->execute();
$updateClientIP = $db_conn->prepare("
UPDATE logs
SET `CLIENT_IP` = ?
WHERE `REQUEST_URL` = ?
AND `CLIENT_IP` = 'Unbekannt'
");
$updateClientIP->bind_param("ss", $ClientIP, $RequestURL);
$updateClientIP->execute();
} else {
DatabaseInsert(
"logs",
+49
View File
@@ -0,0 +1,49 @@
<?php
include_once 'DatabaseController.php';
include_once 'DatabaseConnect.php';
class UserController {
public function setUser($name, $nachname, $email, $passwort, $rolle, $admin) {
$hashedPasswort = password_hash($passwort, PASSWORD_DEFAULT);
DatabaseInsert(
"Benutzer",
"NAME, NACHNAME, EMAIL, PASSWORD, ROLLE, ADMIN",
$name,
$nachname,
$email,
$hashedPasswort,
$rolle,
$admin,
);
}
public function DeleteUSer() {
}
public function CheckUser($login, $passwort) {
$user = DatabaseShow(
"Benutzer",
"*",
"NAME = ? OR EMAIL = ?",
$login,
$login
);
if (empty($user)) {
return false;
}
$user = $user[0];
if (password_verify($passwort, $user['PASSWORD'])) {
return true;
}
return false;
}
}
+29 -30
View File
@@ -1,31 +1,30 @@
<?php
include_once 'controller/CookieController.php';
include_once 'controller/LogController.php';
include_once 'controller/DataController.php';
include_once 'controller/DatabaseConnect.php';
include_once 'moduls/ConsoleLog.php';
$data = new getSpecificData();
$cookie = new cookieController();
$clientIP = $data->getClientIP();
$whitelist = $data->getWhitelistedIPs();
// if (in_array($clientIP, $whitelist)) {
// $cookie->SetCookie("USER", "1", 60);
print_r($data->ShowAllData());
echo '<a href="/controller/RoutesController.php?website=/services/Dashboards/MainDashboard.php">Main Dashboard</a>';
// } else {
// $cookie->SetCookie("USER", "0", 60);
// header("Location: /controller/RoutesController.php?website=/services/Dashboards/MainDashboard.php");
// exit;
// }
$allData = (new getSpecificData())->getAllData();
DebugLog($allData);
<?php
include_once 'controller/CookieController.php';
include_once 'controller/LogController.php';
include_once 'controller/DataController.php';
include_once 'controller/DatabaseConnect.php';
include_once 'moduls/ConsoleLog.php';
$cookie = new cookieController();
$data = new getSpecificData();
$clientIP = $data->getClientIP();
$whitelist = $data->getWhitelistedIPs();
if (in_array($clientIP, $whitelist)) {
$cookie->SetCookie("USER", "1", 60);
print_r($data->ShowAllData());
echo '<a href="/controller/RoutesController.php?website=/services/Dashboards/MainDashboard.php">Main Dashboard</a>';
} else {
$cookie->SetCookie("USER", "0", 60);
header("Location: /controller/RoutesController.php?website=/services/Dashboards/MainDashboard.php");
exit;
}
$allData = (new getSpecificData())->getAllData();
logging();
+14 -14
View File
@@ -1,15 +1,15 @@
<?php
function DebugLog(...$vars) {
echo "<script>";
foreach ($vars as $index => $value) {
$data = [
"Index" => $index,
"Value" => $value
];
echo "console.log(" . json_encode($data) . ");";
}
echo "</script>";
<?php
function ConsoleLog(...$vars) {
echo "<script>";
foreach ($vars as $index => $value) {
$data = [
"Index" => $index,
"Value" => $value
];
echo "console.log(" . json_encode($data) . ");";
}
echo "</script>";
}
@@ -1,5 +1,5 @@
<?php
include_once '../controller/LogController.php';
include_once '../../../controller/LogController.php';
logging();
?>
@@ -81,7 +81,7 @@ logging();
<div class="container">
<h2>Neuen Firmenbericht hinzufügen</h2>
<form action="../moduls/BerichteErstellenInsertModule.php" method="post">
<form action="../../../moduls/BerichteErstellenInsertModule.php" method="post">
<div class="form-group">
<label for="datum">Datum:</label>
@@ -1,6 +1,6 @@
<?php
include_once '../controller/LogController.php';
include_once '../controller/DatabaseConnect.php';
include_once '../../../controller/LogController.php';
include_once '../../../controller/DatabaseConnect.php';
logging();
$conn = db_connect();
@@ -1,5 +1,5 @@
{
"plus": 0,
"minus": 960,
"total": -960
}
{
"plus": 0,
"minus": 960,
"total": -960
}
@@ -0,0 +1,119 @@
<?php
include_once '../../../controller/DatabaseController.php';
include_once '../../../controller/DatabaseConnect.php';
$fach = DatabaseShow(
"Fach",
"ID, FACH"
);
$raum = DatabaseShow(
"Raum",
"ID, RAUM_NR"
);
$lehrer = DatabaseShow(
"Lehrer",
"ID, NAME"
);
$json = json_encode([$fach, $raum, $lehrer], JSON_UNESCAPED_UNICODE);
?>
<!DOCTYPE html>
<html lang="de">
<body>
<h2>Berufsschulbericht</h2>
<form method="post">
<label for="datum">Datum:</label>
<input type="date" name="datum" id="datum_id">
<?php for ($i = 1; $i <= 8; $i++): ?>
<fieldset style="margin-bottom:20px; padding:10px;">
<legend>Stunde <?= $i ?></legend>
<label for="fach_<?= $i ?>">Fach:</label>
<select name="stunden[<?= $i ?>][fach_id]" id="fach_<?= $i ?>"></select>
<label for="raum_<?= $i ?>">Raum:</label>
<select name="stunden[<?= $i ?>][raum_id]" id="raum_<?= $i ?>"></select>
<label for="lehrer_<?= $i ?>">Lehrer:</label>
<select name="stunden[<?= $i ?>][lehrer_id]" id="lehrer_<?= $i ?>"></select>
<label for="inhalt_<?= $i ?>">Inhalt:</label>
<input type="text" name="stunden[<?= $i ?>][inhalt_text]" id="inhalt_<?= $i ?>">
</fieldset>
<?php endfor; ?>
<button type="submit">Absenden</button>
</form>
<script>
const daten = <?= $json ?>;
const faecher = daten[0];
const raeume = daten[1];
const lehrer = daten[2];
function fillSelect(selectId, data, labelKey) {
const select = document.getElementById(selectId);
select.innerHTML = '<option value="">Bitte wählen</option>';
data.forEach(item => {
const option = document.createElement('option');
option.value = item.ID;
option.textContent = item[labelKey];
select.appendChild(option);
});
}
for (let i = 1; i <= 8; i++) {
fillSelect('fach_' + i, faecher, 'FACH');
fillSelect('raum_' + i, raeume, 'RAUM_NR');
fillSelect('lehrer_' + i, lehrer, 'NAME');
}
</script>
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$datum = $_POST['datum'] ?? null;
$werte = [];
for ($i = 1; $i <= 8; $i++) {
$stunde = $_POST['stunden'][$i] ?? [];
$fach = !empty($stunde['fach_id']) ? $stunde['fach_id'] : null;
$lehrer = !empty($stunde['lehrer_id'])? $stunde['lehrer_id'] : null;
$raum = !empty($stunde['raum_id']) ? $stunde['raum_id'] : null;
$inhalt = !empty($stunde['inhalt_text']) ? $stunde['inhalt_text'] : null;
$werte[] = $fach;
$werte[] = $lehrer;
$werte[] = $raum;
$werte[] = $inhalt;
}
DatabaseInsert(
"Berufsschulberichte",
"DATUM,
FACH_S1, LEHRER_S1, RAUM_S1, INHALT_S1,
FACH_S2, LEHRER_S2, RAUM_S2, INHALT_S2,
FACH_S3, LEHRER_S3, RAUM_S3, INHALT_S3,
FACH_S4, LEHRER_S4, RAUM_S4, INHALT_S4,
FACH_S5, LEHRER_S5, RAUM_S5, INHALT_S5,
FACH_S6, LEHRER_S6, RAUM_S6, INHALT_S6,
FACH_S7, LEHRER_S7, RAUM_S7, INHALT_S7,
FACH_S8, LEHRER_S8, RAUM_S8, INHALT_S8",
$datum,
...$werte
);
}
?>
</body>
</html>
+77 -77
View File
@@ -1,78 +1,78 @@
<?php
include_once '../../controller/DatabaseConnect.php';
$conn = db_connect();
// Datum aus Formular
$startDatum = $_GET['start'] ?? null;
$endDatum = $_GET['end'] ?? null;
if (!$startDatum || !$endDatum) {
die("<div class='error'>Bitte Start- und Enddatum angeben.</div>");
}
// Datenbankabfrage
$berichteQuery = "SELECT `DATUM`, `PROZESS_1`, `PROZESS_2`, `PROZESS_3`, `PROZESS_4` FROM Firmenberichte WHERE `DATUM` BETWEEN '$startDatum' AND '$endDatum' ORDER BY `DATUM` ASC";
$result = $conn->query($berichteQuery);
$berichteArray = [];
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$berichteArray[] = $row;
}
} else {
die("<div class='error'>Keine Berichte für den angegebenen Zeitraum gefunden.</div>");
}
$Einzelstunden = "2";
$Gesamtstunden = "8";
// Daten für FDF zusammenstellen
$data = [
'Text1' => '',
'Text2' => $berichteArray[0]['DATUM'],
'Text3' => end($berichteArray)['DATUM'],
'Text4' => 'Eckhardt',
'Text5' => 'Bruno Renato',
'Text6' => '1',
];
$fieldIndex = 7;
foreach ($berichteArray as $bericht) {
for ($i = 1; $i <= 4; $i++) {
$data["Text$fieldIndex"] = $bericht["PROZESS_$i"];
$fieldIndex++;
$data["Text$fieldIndex"] = $Einzelstunden;
$fieldIndex++;
}
$data["Text$fieldIndex"] = $Gesamtstunden;
$fieldIndex++;
}
// FDF erstellen
$fdf = "%FDF-1.2\n";
$fdf .= "1 0 obj\n<<\n/FDF << /Fields [\n";
foreach ($data as $field => $value) {
$value = str_replace(['(', ')'], ['\(', '\)'], $value);
$fdf .= "<< /T ($field) /V ($value) >>\n";
}
$fdf .= "] >> >>\nendobj\ntrailer\n<< /Root 1 0 R >>\n%%EOF";
$fdfFile = tempnam(sys_get_temp_dir(), 'fdf_') . '.fdf';
file_put_contents($fdfFile, $fdf);
$inputPdf = 'ausbildung-ausbildungsnachweis.pdf';
$outputPdf = __DIR__ . '/ausbildungsnachweis_' . $berichteArray[0]['DATUM'] . '-' . end($berichteArray)['DATUM'] . '.pdf';
exec("pdftk $inputPdf fill_form $fdfFile output $outputPdf flatten");
unlink($fdfFile);
$conn->close();
// Link zum fertigen PDF anzeigen
<?php
include_once '../../controller/DatabaseConnect.php';
$conn = db_connect();
// Datum aus Formular
$startDatum = $_GET['start'] ?? null;
$endDatum = $_GET['end'] ?? null;
if (!$startDatum || !$endDatum) {
die("<div class='error'>Bitte Start- und Enddatum angeben.</div>");
}
// Datenbankabfrage
$berichteQuery = "SELECT `DATUM`, `PROZESS_1`, `PROZESS_2`, `PROZESS_3`, `PROZESS_4` FROM Firmenberichte WHERE `DATUM` BETWEEN '$startDatum' AND '$endDatum' ORDER BY `DATUM` ASC";
$result = $conn->query($berichteQuery);
$berichteArray = [];
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$berichteArray[] = $row;
}
} else {
die("<div class='error'>Keine Berichte für den angegebenen Zeitraum gefunden.</div>");
}
$Einzelstunden = "2";
$Gesamtstunden = "8";
// Daten für FDF zusammenstellen
$data = [
'Text1' => '',
'Text2' => $berichteArray[0]['DATUM'],
'Text3' => end($berichteArray)['DATUM'],
'Text4' => 'Eckhardt',
'Text5' => 'Bruno Renato',
'Text6' => '1',
];
$fieldIndex = 7;
foreach ($berichteArray as $bericht) {
for ($i = 1; $i <= 4; $i++) {
$data["Text$fieldIndex"] = $bericht["PROZESS_$i"];
$fieldIndex++;
$data["Text$fieldIndex"] = $Einzelstunden;
$fieldIndex++;
}
$data["Text$fieldIndex"] = $Gesamtstunden;
$fieldIndex++;
}
// FDF erstellen
$fdf = "%FDF-1.2\n";
$fdf .= "1 0 obj\n<<\n/FDF << /Fields [\n";
foreach ($data as $field => $value) {
$value = str_replace(['(', ')'], ['\(', '\)'], $value);
$fdf .= "<< /T ($field) /V ($value) >>\n";
}
$fdf .= "] >> >>\nendobj\ntrailer\n<< /Root 1 0 R >>\n%%EOF";
$fdfFile = tempnam(sys_get_temp_dir(), 'fdf_') . '.fdf';
file_put_contents($fdfFile, $fdf);
$inputPdf = 'ausbildung-ausbildungsnachweis.pdf';
$outputPdf = __DIR__ . '/ausbildungsnachweis_' . $berichteArray[0]['DATUM'] . '-' . end($berichteArray)['DATUM'] . '.pdf';
exec("pdftk $inputPdf fill_form $fdfFile output $outputPdf flatten");
unlink($fdfFile);
$conn->close();
// Link zum fertigen PDF anzeigen
echo "<div class='message success'>PDF erfolgreich erstellt! <a href='$outputPdf' target='_blank'>Hier öffnen</a></div>";
+82 -82
View File
@@ -1,83 +1,83 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>Bericht erstellen</title>
<style>
body {
font-family: Arial, sans-serif;
background: #f5f5f5;
padding: 50px;
}
form {
background: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
max-width: 400px;
margin: auto;
}
label {
display: block;
margin-top: 15px;
font-weight: bold;
}
input[type="date"] {
width: 100%;
padding: 8px;
margin-top: 5px;
}
button {
margin-top: 20px;
padding: 10px 20px;
background: #007bff;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background: #0056b3;
}
.message {
margin-top: 20px;
padding: 10px;
border-radius: 5px;
}
.success {
background: #d4edda;
color: #155724;
}
.error {
background: #f8d7da;
color: #721c24;
}
</style>
</head>
<body>
<h2>Ausbildungsbericht erstellen</h2>
<form method="GET" action="generate.php">
<label for="start">Startdatum:</label>
<input type="date" id="start" name="start" required>
<label for="end">Enddatum:</label>
<input type="date" id="end" name="end" required>
<button type="submit">Bericht erstellen</button>
</form>
</body>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>Bericht erstellen</title>
<style>
body {
font-family: Arial, sans-serif;
background: #f5f5f5;
padding: 50px;
}
form {
background: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
max-width: 400px;
margin: auto;
}
label {
display: block;
margin-top: 15px;
font-weight: bold;
}
input[type="date"] {
width: 100%;
padding: 8px;
margin-top: 5px;
}
button {
margin-top: 20px;
padding: 10px 20px;
background: #007bff;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background: #0056b3;
}
.message {
margin-top: 20px;
padding: 10px;
border-radius: 5px;
}
.success {
background: #d4edda;
color: #155724;
}
.error {
background: #f8d7da;
color: #721c24;
}
</style>
</head>
<body>
<h2>Ausbildungsbericht erstellen</h2>
<form method="GET" action="generate.php">
<label for="start">Startdatum:</label>
<input type="date" id="start" name="start" required>
<label for="end">Enddatum:</label>
<input type="date" id="end" name="end" required>
<button type="submit">Bericht erstellen</button>
</form>
</body>
</html>
+106 -106
View File
@@ -1,107 +1,107 @@
<?php
include_once '../../controller/DatabaseConnect.php';
$conn = db_connect();
$berichte="SELECT `DATUM`, `PROZESS_1`, `PROZESS_2`, `PROZESS_3`, `PROZESS_4` FROM Firmenberichte WHERE `DATUM` BETWEEN '2025-12-08' AND '2025-12-12'";
$result = $conn->query($berichte);
$berichteArray = array();
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$berichteArray[] = $row;
}
}
$Einzelstunden = "2";
$Gesamtstunden = "8";
$data = [
'Text1' => '', // Nr
'Text2' => $berichteArray[0]['DATUM'], // Von
'Text3' => $berichteArray[4]['DATUM'], // Bis
'Text4' => 'Eckhardt',
'Text5' => 'Bruno Renato',
'Text6' => '1', //Ausbildungsjahr
'Text7' => $berichteArray[0]['PROZESS_1'], // Prozess
'Text8' => $Einzelstunden, // Einzelstunden
'Text9' => $berichteArray[0]['PROZESS_2'], // Prozess
'Text10' => $Einzelstunden, // Einzelstunden
'Text11' => $berichteArray[0]['PROZESS_3'], // Prozess
'Text12' => $Einzelstunden, // Einzelstunden
'Text13' => $berichteArray[0]['PROZESS_4'], // Prozess
'Text14' => $Einzelstunden, // Einzelstunden
'Text15' => $Gesamtstunden, // Gesamtstunden
'Text16' => $berichteArray[1]['PROZESS_1'],
'Text17' => $Einzelstunden, // Einzelstunden
'Text18' => $berichteArray[1]['PROZESS_2'],
'Text19' => $Einzelstunden, // Einzelstunden
'Text20' => $berichteArray[1]['PROZESS_3'],
'Text21' => $Einzelstunden, // Einzelstunden
'Text22' => $berichteArray[1]['PROZESS_4'],
'Text23' => $Einzelstunden, // Einzelstunden
'Text24' => $Gesamtstunden, // Gesamtstunden
'Text25' => $berichteArray[2]['PROZESS_1'],
'Text26' => $Einzelstunden, // Einzelstunden
'Text27' => $berichteArray[2]['PROZESS_2'],
'Text28' => $Einzelstunden, // Einzelstunden
'Text29' => $berichteArray[2]['PROZESS_3'],
'Text30' => $Einzelstunden, // Einzelstunden
'Text31' => $berichteArray[2]['PROZESS_4'],
'Text32' => $Einzelstunden, // Einzelstunden
'Text33' => $Gesamtstunden, // Gesamtstunden
'Text34' => $berichteArray[3]['PROZESS_1'],
'Text35' => $Einzelstunden, // Einzelstunden
'Text36' => $berichteArray[3]['PROZESS_2'],
'Text37' => $Einzelstunden, // Einzelstunden
'Text38' => $berichteArray[3]['PROZESS_3'],
'Text39' => $Einzelstunden, // Einzelstunden
'Text40' => $berichteArray[3]['PROZESS_4'],
'Text41' => $Einzelstunden, // Einzelstunden
'Text42' => $Gesamtstunden, // Gesamtstunden
'Text43' => $berichteArray[4]['PROZESS_1'],
'Text44' => $Einzelstunden, // Einzelstunden
'Text45' => $berichteArray[4]['PROZESS_2'],
'Text46' => $Einzelstunden, // Einzelstunden
'Text47' => $berichteArray[4]['PROZESS_3'],
'Text48' => $Einzelstunden, // Einzelstunden
'Text49' => $berichteArray[4]['PROZESS_4'],
'Text50' => $Einzelstunden, // Einzelstunden
'Text51' => $Gesamtstunden, // Gesamtstunden
];
$fdf = "%FDF-1.2\n";
$fdf .= "1 0 obj\n<<\n/FDF << /Fields [\n";
foreach ($data as $field => $value) {
$value = str_replace(['(', ')'], ['\(', '\)'], $value);
$fdf .= "<< /T ($field) /V ($value) >>\n";
}
$fdf .= "] >> >>\nendobj\ntrailer\n<< /Root 1 0 R >>\n%%EOF";
$fdfFile = tempnam(sys_get_temp_dir(), 'fdf_') . '.fdf';
file_put_contents($fdfFile, $fdf);
$inputPdf = 'ausbildung-ausbildungsnachweis.pdf';
$outputPdf = 'ausbildungsnachweis_' . $berichteArray[0]['DATUM'] . '-' . $berichteArray[4]['DATUM'] . '.pdf';
exec("pdftk $inputPdf fill_form $fdfFile output $outputPdf flatten");
unlink($fdfFile);
echo "PDF erfolgreich erstellt!";
<?php
include_once '../../controller/DatabaseConnect.php';
$conn = db_connect();
$berichte="SELECT `DATUM`, `PROZESS_1`, `PROZESS_2`, `PROZESS_3`, `PROZESS_4` FROM Firmenberichte WHERE `DATUM` BETWEEN '2025-12-08' AND '2025-12-12'";
$result = $conn->query($berichte);
$berichteArray = array();
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$berichteArray[] = $row;
}
}
$Einzelstunden = "2";
$Gesamtstunden = "8";
$data = [
'Text1' => '', // Nr
'Text2' => $berichteArray[0]['DATUM'], // Von
'Text3' => $berichteArray[4]['DATUM'], // Bis
'Text4' => 'Eckhardt',
'Text5' => 'Bruno Renato',
'Text6' => '1', //Ausbildungsjahr
'Text7' => $berichteArray[0]['PROZESS_1'], // Prozess
'Text8' => $Einzelstunden, // Einzelstunden
'Text9' => $berichteArray[0]['PROZESS_2'], // Prozess
'Text10' => $Einzelstunden, // Einzelstunden
'Text11' => $berichteArray[0]['PROZESS_3'], // Prozess
'Text12' => $Einzelstunden, // Einzelstunden
'Text13' => $berichteArray[0]['PROZESS_4'], // Prozess
'Text14' => $Einzelstunden, // Einzelstunden
'Text15' => $Gesamtstunden, // Gesamtstunden
'Text16' => $berichteArray[1]['PROZESS_1'],
'Text17' => $Einzelstunden, // Einzelstunden
'Text18' => $berichteArray[1]['PROZESS_2'],
'Text19' => $Einzelstunden, // Einzelstunden
'Text20' => $berichteArray[1]['PROZESS_3'],
'Text21' => $Einzelstunden, // Einzelstunden
'Text22' => $berichteArray[1]['PROZESS_4'],
'Text23' => $Einzelstunden, // Einzelstunden
'Text24' => $Gesamtstunden, // Gesamtstunden
'Text25' => $berichteArray[2]['PROZESS_1'],
'Text26' => $Einzelstunden, // Einzelstunden
'Text27' => $berichteArray[2]['PROZESS_2'],
'Text28' => $Einzelstunden, // Einzelstunden
'Text29' => $berichteArray[2]['PROZESS_3'],
'Text30' => $Einzelstunden, // Einzelstunden
'Text31' => $berichteArray[2]['PROZESS_4'],
'Text32' => $Einzelstunden, // Einzelstunden
'Text33' => $Gesamtstunden, // Gesamtstunden
'Text34' => $berichteArray[3]['PROZESS_1'],
'Text35' => $Einzelstunden, // Einzelstunden
'Text36' => $berichteArray[3]['PROZESS_2'],
'Text37' => $Einzelstunden, // Einzelstunden
'Text38' => $berichteArray[3]['PROZESS_3'],
'Text39' => $Einzelstunden, // Einzelstunden
'Text40' => $berichteArray[3]['PROZESS_4'],
'Text41' => $Einzelstunden, // Einzelstunden
'Text42' => $Gesamtstunden, // Gesamtstunden
'Text43' => $berichteArray[4]['PROZESS_1'],
'Text44' => $Einzelstunden, // Einzelstunden
'Text45' => $berichteArray[4]['PROZESS_2'],
'Text46' => $Einzelstunden, // Einzelstunden
'Text47' => $berichteArray[4]['PROZESS_3'],
'Text48' => $Einzelstunden, // Einzelstunden
'Text49' => $berichteArray[4]['PROZESS_4'],
'Text50' => $Einzelstunden, // Einzelstunden
'Text51' => $Gesamtstunden, // Gesamtstunden
];
$fdf = "%FDF-1.2\n";
$fdf .= "1 0 obj\n<<\n/FDF << /Fields [\n";
foreach ($data as $field => $value) {
$value = str_replace(['(', ')'], ['\(', '\)'], $value);
$fdf .= "<< /T ($field) /V ($value) >>\n";
}
$fdf .= "] >> >>\nendobj\ntrailer\n<< /Root 1 0 R >>\n%%EOF";
$fdfFile = tempnam(sys_get_temp_dir(), 'fdf_') . '.fdf';
file_put_contents($fdfFile, $fdf);
$inputPdf = 'ausbildung-ausbildungsnachweis.pdf';
$outputPdf = 'ausbildungsnachweis_' . $berichteArray[0]['DATUM'] . '-' . $berichteArray[4]['DATUM'] . '.pdf';
exec("pdftk $inputPdf fill_form $fdfFile output $outputPdf flatten");
unlink($fdfFile);
echo "PDF erfolgreich erstellt!";
$conn->close();
+171
View File
@@ -0,0 +1,171 @@
<?php
include_once '../controller/LogController.php';
include_once '../controller/DatabaseConnect.php';
logging();
$conn = db_connect();
$filter = $_GET['filter'] ?? 'today';
$customQuery = $_POST['custom_query'] ?? '';
$useCustom = false;
if ($customQuery) {
$forbidden = ['DELETE', 'UPDATE', 'INSERT', 'DROP', 'ALTER', 'TRUNCATE'];
$upper = strtoupper($customQuery);
foreach ($forbidden as $bad) {
if (strpos($upper, $bad) !== false) {
die("<b style='color:red'>Gefährliche Query blockiert! ($bad gefunden)</b>");
}
}
if (stripos($customQuery, "SELECT") !== 0) {
die("<b style='color:red'>Nur SELECT-Befehle sind erlaubt!</b>");
}
$sql = $customQuery;
$useCustom = true;
}
if (!$useCustom) {
switch ($filter) {
case 'Firma':
$sql = "SELECT DATUM, EVENT FROM Kalender WHERE EVENT LIKE '%Firma%' ORDER BY DATUM;";
break;
case 'Urlaub':
$sql = "SELECT DATUM, EVENT FROM Kalender WHERE EVENT LIKE '%Urlaub%' ORDER BY DATUM;";
break;
case 'UrlaubGesetzlicher':
$sql = "SELECT DATUM, EVENT FROM Kalender WHERE EVENT LIKE '%Urlaub%' OR EVENT LIKE '%Gesetzlicher%' ORDER BY DATUM;";
break;
case 'Berufsschule':
$sql = "SELECT DATUM, EVENT FROM Kalender WHERE EVENT LIKE '%Berufsschule%' ORDER BY DATUM;";
break;
case 'andere':
$sql = "SELECT DATUM, EVENT FROM Kalender WHERE EVENT NOT LIKE '%Berufsschule%' AND EVENT NOT LIKE '%Urlaub%' AND EVENT NOT LIKE '%Firma%' ORDER BY DATUM;
";
break;
case 'alle':
$sql = "SELECT DATUM, EVENT FROM Kalender ORDER BY DATUM;";
break;
case 'today':
default:
$sql = "SELECT DATUM, EVENT FROM Kalender WHERE DATUM = CURRENT_DATE;";
}
}
if (isset($_GET['action']) && $_GET['action'] === 'export_csv') {
$daten = [];
if ($erg = $conn->query($sql)) {
while ($datensatz = $erg->fetch_assoc()) {
$daten[] = $datensatz;
}
$erg->free();
}
if (!empty($daten)) {
header('Content-Type: text/csv; charset=utf-8');
// header('Content-Disposition: attachment; filename=kalender_export.csv');
header('Content-Disposition: attachment; filename=' . $filter . '.csv');
$output = fopen('php://output', 'w');
fprintf($output, chr(0xEF).chr(0xBB).chr(0xBF));
fputcsv($output, array_keys($daten[0]), ';');
foreach ($daten as $row) {
fputcsv($output, $row, ';');
}
fclose($output);
}
exit;
}
echo "<h1>Datenbank auslesen um " . date("H:i:s") . "</h1>";
echo '<br>';
?>
<form method="GET">
<form method="GET">
<label><b>Tage-Filter auswählen:</b></label>
<select name="filter" onchange="this.form.submit()">
<option value="today" <?= $filter == 'today' ? 'selected' : '' ?>>Heute</option>
<option value="alle" <?= $filter == 'alle' ? 'selected' : '' ?>>Alle</option>
<option value="Firma" <?= $filter == 'Firma' ? 'selected' : '' ?>>Firma</option>
<option value="Berufsschule" <?= $filter == 'Berufsschule' ? 'selected' : '' ?>>Berufsschule</option>
<option value="Urlaub" <?= $filter == 'Urlaub' ? 'selected' : '' ?>>Urlaub</option>
<option value="UrlaubGesetzlicher" <?= $filter == 'UrlaubGesetzlicher' ? 'selected' : '' ?>>Urlaub und
Gesetzlicher</option>
<option value="andere" <?= $filter == 'andere' ? 'selected' : '' ?>>andere</option>
</select>
</form>
<form method="GET" style="margin-top:10px;">
<input type="hidden" name="filter" value="<?= htmlspecialchars($filter) ?>">
<?php if ($customQuery): ?>
<input type="hidden" name="custom_query" value="<?= htmlspecialchars($customQuery) ?>">
<?php endif; ?>
<input type="hidden" name="action" value="export_csv">
<button type="submit">Als CSV exportieren</button>
</form>
</form>
<br>
<?php
$daten = [];
if ($erg = $conn->query($sql)) {
if ($erg->num_rows) {
echo "<b>Gefundene Einträge: " . $erg->num_rows . "</b><br><br>";
} else {
echo "<b>Keine Datensätze gefunden.</b><br><br>";
}
while ($datensatz = $erg->fetch_object()) {
$daten[] = $datensatz;
}
$erg->free();
}
echo "<h2>Ergebnis:</h2>";
if (empty($daten)) {
echo "<b>Keine Daten vorhanden.</b>";
} else {
echo '<div style="max-width: 100%; overflow-x: auto;">';
echo '<table border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse; width:100%; font-family:Arial; font-size:14px;">';
echo "<tr style='background:#f0f0f0; font-weight:bold;'>";
foreach ($daten[0] as $spaltenname => $wert) {
echo "<th style='text-align:left; padding:6px; word-break:break-word; white-space:normal;'>" . htmlspecialchars($spaltenname ?? '') . "</th>";
}
echo "</tr>";
foreach ($daten as $row) {
echo "<tr>";
foreach ($row as $value) {
echo "<td style='padding:6px; word-break:break-word; white-space:normal; max-width:300px;'>" . htmlspecialchars($value ?? '') . "</td>";
}
echo "</tr>";
}
echo "</table>";
echo "</div>";
}
exit;
?>
+11 -11
View File
@@ -1,12 +1,12 @@
<?php
include_once '../controller/LogController.php';
logging();
$sitemapUrl = "http://blackpi.ipv64.net/sitemap.xml";
$xml = simplexml_load_file($sitemapUrl);
foreach ($xml->url as $urlEntry) {
$loc = (string) $urlEntry->loc;
echo '<div><a href="'.$loc.'" target="_blank">'.$loc.'</a></div>';
<?php
include_once '../controller/LogController.php';
logging();
$sitemapUrl = "http://blackpi.ipv64.net/sitemap.xml";
$xml = simplexml_load_file($sitemapUrl);
foreach ($xml->url as $urlEntry) {
$loc = (string) $urlEntry->loc;
echo '<div><a href="'.$loc.'" target="_blank">'.$loc.'</a></div>';
}
+29 -75
View File
@@ -1,81 +1,35 @@
<?php
$data = file_get_contents("../templates/StundenplanBruno.json");
$stundenplan = json_decode($data, true);
if (!$stundenplan) {
die("Fehler beim Laden des Stundenplans!");
}
include_once '../controller/DatabaseController.php';
include_once '../controller/DatabaseConnect.php';
// Alle Zeiten sammeln
$zeiten = [];
foreach ($stundenplan as $tag => $stunden) {
foreach ($stunden as $zeit => $fach) {
$zeiten[$zeit] = true;
$std = DatabaseShowWithFK(
"Stundenplan",
$Stundenplan,
// "MO"
);
$rows = $std['rows'];
if (!empty($rows)) {
echo '<table border="1" cellpadding="15" cellspacing="0">';
echo '<tr>';
foreach (array_keys($rows[0]) as $header) {
echo '<th>' . htmlspecialchars($header) . '</th>';
}
}
$zeiten = array_keys($zeiten);
sort($zeiten); // Zeiten sortieren
?>
<!DOCTYPE html>
<html lang="de">
echo '</tr>';
<head>
<meta charset="UTF-8">
<title>Stundenplan</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 30px;
foreach ($rows as $row) {
echo '<tr>';
foreach ($row as $cell) {
$value = $cell ?? '';
echo '<td>' . ($value === '' ? '&nbsp;' : htmlspecialchars($value)) . '</td>';
}
echo '</tr>';
}
table {
border-collapse: collapse;
width: 100%;
text-align: center;
}
th,
td {
border: 1px solid #444;
padding: 10px;
}
th {
background: #ddd;
}
td {
background: #f9f9f9;
}
caption {
font-size: 1.5em;
margin-bottom: 15px;
}
</style>
</head>
<body>
<table>
<caption>Brunos Stundenplan</caption>
<tr>
<th>Zeit</th>
<?php foreach ($stundenplan as $tag => $stunden): ?>
<th><?= htmlspecialchars($tag) ?></th>
<?php endforeach; ?>
</tr>
<?php foreach ($zeiten as $zeit): ?>
<tr>
<td><?= htmlspecialchars($zeit) ?></td>
<?php foreach ($stundenplan as $tag => $stunden): ?>
<td>
<?= isset($stunden[$zeit]) ? htmlspecialchars($stunden[$zeit]) : "-" ?>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</table>
</body>
</html>
echo '</table>';
} else {
echo 'Keine Daten vorhanden';
}
+16
View File
@@ -0,0 +1,16 @@
<?php
include_once '../controller/UserController.php';
include_once '../controller/DatabaseController.php';
include_once '../controller/DatabaseConnect.php';
include_once '../moduls/ConsoleLog.php';
$valdiation = ((new UserController())->CheckUser("bruno.eckhardt@gmx.de", "bBHofurUJWKzPE8Z"));
if ($valdiation === true) {
echo "Authorized";
} else {
echo "Unauthorized";
}
// (new UserController())->setUser("Bruno", "Eckhardt", "bruno.eckhardt@gmx.de", "bBHofurUJWKzPE8Z", "Developer", "1");
+41
View File
@@ -0,0 +1,41 @@
<?php
session_start();
include_once "../../controller/DatabaseConnect.php";
include_once "../../controller/DatabaseController.php";
include_once "../../moduls/ConsoleLog.php";
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$username = $_POST["username"] ?? "";
$password = $_POST["password"] ?? "";
$user = DatabaseShow(
"Benutzer",
"NAME, PASSWORD",
"NAME = ? AND PASSWORD = ?",
$username,
$password,
);
ConsoleLog($user);
if ($user && password_verify($password, $user["password"])) {
$_SESSION["user_id"] = $user["id"];
$_SESSION["username"] = $user["username"];
// header("Location: dashboard.php");
// exit;
$error = "Erforlg";
} else {
$error = "Login fehlgeschlagen";
}
}
?>
<form method="post">
<input type="text" name="username" placeholder="Benutzername" required>
<input type="password" name="password" placeholder="Passwort" required>
<button type="submit">Login</button>
</form>
<?php if (!empty($error)) echo $error; ?>
+2 -1
View File
@@ -15,12 +15,13 @@ $buttons = [
["name" => "Sitemap.xml", "link" => "$routing=/sitemap.xml", "color" => $buttoncoloractive],
["name" => "Sitemap", "link" => "$routing=/services/SitemapXMLShow.php", "color" => $buttoncoloractive],
["name" => "Robots.txt", "link" => "$routing=/robots.txt", "color" => $buttoncoloractive],
["name" => "Berichte", "link" => "$routing=/services/BerichteShow.php", "color" => $buttoncoloractive],
["name" => "Berichte", "link" => "$routing=/services/Berichte/Arbeitsberichte/ArbeitsberichteShow.php", "color" => $buttoncoloractive],
]],
["section" => "Dev", "buttons" => [
["name" => "Gitea / Code", "link" => "$routing=http://gitea.blackpi.ipv64.net/", "color" => $buttoncoloractive], // Username: bruno | Passwort: bBHofurUJWKzPE8Z
["name" => "HAProxy", "link" => "$routing=http://stats.blackpi.ipv64.net/", "color" => $buttoncoloractive],
["name" => "Test Site", "link" => "$routing=/services/test.php", "color" => $buttoncoloractive],
]],
["section" => "Management", "buttons" => [
@@ -34,23 +34,23 @@ $buttons = [
["name" => "Zyxel GS1910-24", "link" => "$routing=http://switch.blackpi.ipv64.net", "color" => $buttoncoloractive],
["name" => "NWA5121-NI Innen", "link" => "$routing=http://ap-1.blackpi.ipv64.net", "color" => $buttoncoloractive],
["name" => "NWA5121-NI Außen", "link" => "$routing=http://ap-2.blackpi.ipv64.net", "color" => $buttoncoloractive],
["name" => "ZyWALL 20", "link" => "$routing=http://10.233.1.20", "color" => $buttoncoloractive],
["name" => "ZyWALL 20", "link" => "$routing=http://10.233.1.20", "color" => $buttoncolorinactive],
["name" => "ZyWALL 110 WAN 1", "link" => "$routing=http://10.233.1.248", "color" => $buttoncoloractive],
["name" => "ZyWALL 110 WAN 2", "link" => "$routing=http://10.233.1.249", "color" => $buttoncoloractive],
]],
["section" => "Proxmox-LXC", "buttons" => [
["name" => "Chatserver", "link" => "$routing=http://100.97.206.98/chat/", "color" => $buttoncoloractive],
["name" => "Nextcloud", "link" => "$routing=http://100.122.126.69", "color" => $buttoncoloractive],
["name" => "Heimdall", "link" => "$routing=http://proxmox-tower-ubuntu-server2", "color" => $buttoncoloractive],
["name" => "Chatserver", "link" => "$routing=http://100.97.206.98/chat/", "color" => $buttoncolorinactive],
["name" => "Nextcloud", "link" => "$routing=http://100.122.126.69", "color" => $buttoncolorinactive],
["name" => "Heimdall", "link" => "$routing=http://proxmox-tower-ubuntu-server2", "color" => $buttoncolorinactive],
]],
["section" => "Proxmox-VM", "buttons" => [
["name" => "US 1 Webmin", "link" => "http://100.75.98.83:10000", "color" => $buttoncoloractive],
["name" => "US 2 Webmin", "link" => "http://100.120.248.66:10000", "color" => $buttoncoloractive],
["name" => "US 3 Webmin", "link" => "http://100.121.22.107:10000", "color" => $buttoncoloractive],
["name" => "US 4 Webmin", "link" => "http://100.97.206.98:10000", "color" => $buttoncoloractive],
["name" => "US 5 Webmin", "link" => "http://100.122.126.69:10000", "color" => $buttoncoloractive],
["name" => "US 1 Webmin", "link" => "http://100.75.98.83:10000", "color" => $buttoncolorinactive],
["name" => "US 2 Webmin", "link" => "http://100.120.248.66:10000", "color" => $buttoncolorinactive],
["name" => "US 3 Webmin", "link" => "http://100.121.22.107:10000", "color" => $buttoncolorinactive],
["name" => "US 4 Webmin", "link" => "http://100.97.206.98:10000", "color" => $buttoncolorinactive],
["name" => "US 5 Webmin", "link" => "http://100.122.126.69:10000", "color" => $buttoncolorinactive],
]],
@@ -10,7 +10,9 @@ $buttons = [
["name" => "Vertretungsplan", "link" => "$routing=https://sbsz-hsp.de/sdb/getPlan", "color" => $buttoncoloractive],
["name" => "Stundenplan Sophia", "link" => "$routing=/services/StundenplanSophia.php", "color" => $buttoncoloractive],
["name" => "Stundenplan Bruno", "link" => "$routing=/services/StundenplanBruno.php", "color" => $buttoncoloractive],
["name" => "Berichte Erstellen", "link" => "$routing=/services/BerichteErstellen.php", "color" => $buttoncoloractive],
["name" => "Arbeitsberichte Erstellen", "link" => "$routing=/services/Berichte/Arbeitsberichte/ArbeitsberichteErstellen.php", "color" => $buttoncoloractive],
["name" => "Berufsschulberichte Erstellen", "link" => "$routing=/services/Berichte/Berufsschulberichte/BerufsschulberichtErstellen.php", "color" => $buttoncoloractive],
["name" => "Kalender", "link" => "$routing=/services/KalenderShow.php", "color" => $buttoncoloractive],
]],
["section" => "Webserver", "buttons" => [