From a0674b2587426ef1592b5dcac7071335867098c8 Mon Sep 17 00:00:00 2001 From: worker Date: Mon, 26 Jan 2026 16:49:04 +0100 Subject: [PATCH] init rest --- GIT-MGMT.sh | 73 +++++++ PUBLIC.code-workspace | 46 +++++ WEBROOT/config.php | 8 + WEBROOT/controller/CookieController.php | 39 ++++ WEBROOT/controller/DataController.php | 188 ++++++++++++++++++ WEBROOT/controller/DatabaseConnect.php | 42 ++++ WEBROOT/controller/DatabaseController.php | 177 +++++++++++++++++ WEBROOT/controller/LogController.php | 80 ++++++++ WEBROOT/controller/RoutesController.php | 31 +++ WEBROOT/controller/UserController.php | 49 +++++ index.php => WEBROOT/index.php | 54 +++-- WEBROOT/services/request_chart.php | 96 +++++++++ WEBROOT/services/request_logs.php | 173 ++++++++++++++++ {services => WEBROOT/services}/service3.php | 0 .../services}/services_control.php | 0 style.css => WEBROOT/style.css | 7 + config.php | 8 - services/request_chart.php | 93 --------- services/service2.php | 2 - 19 files changed, 1041 insertions(+), 125 deletions(-) create mode 100644 GIT-MGMT.sh create mode 100644 PUBLIC.code-workspace create mode 100644 WEBROOT/config.php create mode 100644 WEBROOT/controller/CookieController.php create mode 100644 WEBROOT/controller/DataController.php create mode 100644 WEBROOT/controller/DatabaseConnect.php create mode 100644 WEBROOT/controller/DatabaseController.php create mode 100644 WEBROOT/controller/LogController.php create mode 100644 WEBROOT/controller/RoutesController.php create mode 100644 WEBROOT/controller/UserController.php rename index.php => WEBROOT/index.php (51%) create mode 100644 WEBROOT/services/request_chart.php create mode 100644 WEBROOT/services/request_logs.php rename {services => WEBROOT/services}/service3.php (100%) rename {services => WEBROOT/services}/services_control.php (100%) rename style.css => WEBROOT/style.css (98%) delete mode 100644 config.php delete mode 100644 services/request_chart.php delete mode 100644 services/service2.php diff --git a/GIT-MGMT.sh b/GIT-MGMT.sh new file mode 100644 index 0000000..cf46dde --- /dev/null +++ b/GIT-MGMT.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +while true; do + +echo "" +echo "=============================" +echo " Git Management Script" +echo "=============================" +echo "" +echo "1) Geänderte Dateien anzeigen" +echo "2) Einzelne Dateien zum Commit auswählen" +echo "3) Alles stagen" +echo "4) Commit & Push" +echo "5) Alte Stände anzeigen" +echo "6) Aktueller Branch" +echo "7) Änderungen" +echo "99) Programm beenden" +echo "" + +read -p "Auswahl: " auswahl + +case $auswahl in + + 1) + echo "Geänderte Dateien:" + git status -s + ;; + + 2) + echo "Geänderte Dateien:" + git status -s + echo "" + read -p "Welche Datei soll gestaged werden? (Pfad eingeben): " file + git add "$file" + echo ">> Datei '$file' wurde gestaged." + ;; + + 3) + echo ">> Alle Dateien werden gestaged..." + git add -A + ;; + + 4) + read -p "Commit Nachricht: " commitmsg + git commit -m "$commitmsg" + echo ">> Pushen..." + git push + ;; + + 5) + echo ">> Alte Commits:" + git log --oneline --graph --decorate --all + ;; + 6) + echo "Aktueller Branch" + git branch + ;; + 7) + echo "Änderungen" + git status + ;; + + 99) + echo "Beendet." + exit 0 + ;; + + *) + echo "Ungültige Auswahl!" + ;; +esac +done + diff --git a/PUBLIC.code-workspace b/PUBLIC.code-workspace new file mode 100644 index 0000000..81f970f --- /dev/null +++ b/PUBLIC.code-workspace @@ -0,0 +1,46 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": { + "workbench.colorTheme": "Default Dark Modern", + "workbench.colorCustomizations": { + "activityBar.background": "#ff000075", + "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": "BACKEND", + "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", + ] + } +} \ No newline at end of file diff --git a/WEBROOT/config.php b/WEBROOT/config.php new file mode 100644 index 0000000..d7b59a1 --- /dev/null +++ b/WEBROOT/config.php @@ -0,0 +1,8 @@ + ['name' => 'Service 1', 'active' => false], + 'request_logs' => ['name' => 'Request Logs', 'active' => true], + 'request_chart' => ['name' => 'Request Statics', 'active' => true], + 'services_control' => ['name' => 'Services Control', 'active' => true], +]; +?> \ No newline at end of file diff --git a/WEBROOT/controller/CookieController.php b/WEBROOT/controller/CookieController.php new file mode 100644 index 0000000..d95870d --- /dev/null +++ b/WEBROOT/controller/CookieController.php @@ -0,0 +1,39 @@ +SetCookie("USER", "7", 60); + */ + +/** + * Cookie auslesen: + * $cookieValue = $cookieManager->readCookieValueCookie("USER"); + * echo $cookieValue; + */ + +/** + * Cookie loeschen: + * $cookieManager->DeleteCookie("USER"); + */ \ No newline at end of file diff --git a/WEBROOT/controller/DataController.php b/WEBROOT/controller/DataController.php new file mode 100644 index 0000000..f0eacd8 --- /dev/null +++ b/WEBROOT/controller/DataController.php @@ -0,0 +1,188 @@ +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; + + if ($xff) { + $ips = array_map('trim', explode(',', $xff)); + $clientIp = $ips[0]; + return $clientIp; + } else { + return $_SERVER['REMOTE_ADDR']; + } + } + + public function getRequestTime(): string { + date_default_timezone_set('Europe/Berlin'); + $timestamp = $_SERVER['REQUEST_TIME'] ?? time(); + return date('Y-m-d H:i:s', $timestamp); + } + + function getGeoIP($ClientIP) { + $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() { + include_once 'DatabaseController.php'; + $data = DatabaseShow( + "Whitelisted", + "`IP-ADDRESSE`" + ); + + $results = []; + foreach ($data as $row) { + $results[] =$row['IP-ADDRESSE']; + } + return $results; + } + + function getServerNode($ServerIP) { + $nodes = [ + 'node1' => '172.30.0.11', + '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) { + return $node; + break; + } + } + } + + function getClientStatus($ClientIP) { + if (in_array($ClientIP, $this->getWhitelistedIPs())) { + return "Trusted"; + } + return "Untrusted"; + } + + function test() { + return "TEST"; + } + + public function getAllData(): array { + return [ + '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 "
";
+        foreach ($SpecificData as $key => $value) {
+            if (is_array($value)) {
+                $value = implode(', ', $value);
+            }
+        printf("%-22s : %s\n", $key, $value);
+        }
+        echo "
"; + } +} \ No newline at end of file diff --git a/WEBROOT/controller/DatabaseConnect.php b/WEBROOT/controller/DatabaseConnect.php new file mode 100644 index 0000000..d1c4b41 --- /dev/null +++ b/WEBROOT/controller/DatabaseConnect.php @@ -0,0 +1,42 @@ + [ + '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', + ] + ]; + + $enviroment = 'vpn'; + + $conn = new mysqli( + $servers[$enviroment]['hostaddr'], + $servers[$enviroment]['username'], + $servers[$enviroment]['password'], + $servers[$enviroment]['database'], + ); + + if ($conn->connect_error) { + throw new Exception('Connection Error: ' . $conn->connect_error); + } + + $conn->set_charset("utf8mb4"); + return $conn; +} + +?> \ No newline at end of file diff --git a/WEBROOT/controller/DatabaseController.php b/WEBROOT/controller/DatabaseController.php new file mode 100644 index 0000000..1095905 --- /dev/null +++ b/WEBROOT/controller/DatabaseController.php @@ -0,0 +1,177 @@ +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"] +]; \ No newline at end of file diff --git a/WEBROOT/controller/LogController.php b/WEBROOT/controller/LogController.php new file mode 100644 index 0000000..dbeed92 --- /dev/null +++ b/WEBROOT/controller/LogController.php @@ -0,0 +1,80 @@ +getClientIP(); + $UserAgent = (new getSpecificData())->getUserAgent(); + $RequestURL = (new getSpecificData())->getRequestURL(); + $USERCOOKIE = (new getSpecificData())->getCookie("USER"); + $SessionID = (new getSpecificData())->getSessionID(); + $REQUESTTIME = (new getSpecificData())->getRequestTime(); + $QUERY = (new getSpecificData())->getQuery(); + $LAND = (new getSpecificData())->getGeoIP($ClientIP); + $Whitelisted = (new getSpecificData())->getWhitelistedIPs(); + $node = (new getSpecificData())->getServerNode((new getSpecificData())->getServerIP()); + + if (in_array($ClientIP, $Whitelisted)) { + return; + } + + $db_conn = db_connect(); + + $stmt = $db_conn->prepare("SELECT * FROM logs WHERE + `CLIENT_IP` LIKE ? and + `REQUEST_URL` = ? and + `REQUEST_URL` <> '/favicon.ico' + "); + + $stmt->bind_param("ss", $ClientIP, $RequestURL); + $stmt->execute(); + $stmt->store_result(); + + if ($RequestURL !== '/favicon.ico') { + if ($stmt->num_rows > 0) { //wenn mindestens eine zeile vorhanden ist für die client ip dann führe updates durch, wenn nicht mache neue zeile + $updateCounter = $db_conn->prepare(" + UPDATE logs + SET COUNTER = COUNTER + 1 + WHERE `CLIENT_IP` = ? + AND `REQUEST_URL` = ? + "); + $updateCounter->bind_param("ss", $ClientIP, $RequestURL); + $updateCounter->execute(); + + $updateLastRequest = $db_conn->prepare(" + UPDATE logs + SET `LAST_REQUEST` = ? + WHERE `CLIENT_IP` = ? + AND `REQUEST_URL` = ? + "); + $updateLastRequest->bind_param("sss", $REQUESTTIME, $ClientIP, $RequestURL); + $updateLastRequest->execute(); + + $updateCookieValue = $db_conn->prepare(" + UPDATE logs + SET `USER_COOKIE_VALUE` = ? + WHERE `CLIENT_IP` = ? + AND `REQUEST_URL` = ? + "); + $updateCookieValue->bind_param("sss", $USERCOOKIE, $ClientIP, $RequestURL); + $updateCookieValue->execute(); + } else { + DatabaseInsert( + "logs", + "CLIENT_IP, LAND, SERVER_IP, USER_AGENT, REQUEST_URL, USER_COOKIE_VALUE, USER_SESSION_VALUE, FIRST_REQUEST, QUERY", + $ClientIP, + $LAND, + $node, + $UserAgent, + $RequestURL, + $USERCOOKIE, + $SessionID, + $REQUESTTIME, + $QUERY + ); + } + } +} \ No newline at end of file diff --git a/WEBROOT/controller/RoutesController.php b/WEBROOT/controller/RoutesController.php new file mode 100644 index 0000000..6eb0aee --- /dev/null +++ b/WEBROOT/controller/RoutesController.php @@ -0,0 +1,31 @@ + + Service Website +
Meine Services @@ -29,13 +38,13 @@ if (isset($_GET['service']) && isset($services[$_GET['service']]) && $services[$
@@ -50,22 +59,23 @@ if (isset($_GET['service']) && isset($services[$_GET['service']]) && $services[$
- + + \ No newline at end of file diff --git a/WEBROOT/services/request_chart.php b/WEBROOT/services/request_chart.php new file mode 100644 index 0000000..0e002ad --- /dev/null +++ b/WEBROOT/services/request_chart.php @@ -0,0 +1,96 @@ +connect_error) { + die("Verbindung fehlgeschlagen: " . $conn->connect_error); +} + +$sql = "SELECT DATE(FIRST_REQUEST) as tag, COUNT(*) as anzahl FROM logs GROUP BY DATE(FIRST_REQUEST) ORDER BY DATE(FIRST_REQUEST)"; +$result = $conn->query($sql); + +$labels = []; +$data = []; + +if ($result->num_rows > 0) { + while($row = $result->fetch_assoc()) { + $labels[] = $row['tag']; + $data[] = (int)$row['anzahl']; + } +} + +$conn->close(); +?> + + + + + + + Logs Chart + + + + + + + + + + + + \ No newline at end of file diff --git a/WEBROOT/services/request_logs.php b/WEBROOT/services/request_logs.php new file mode 100644 index 0000000..17e066e --- /dev/null +++ b/WEBROOT/services/request_logs.php @@ -0,0 +1,173 @@ +getWhitelistedIPs(); +$devips_sql = "'" . implode("','", $devips) . "'"; + +// Filter +$filter = $_GET['filter'] ?? 'today'; +$customQuery = $_POST['custom_query'] ?? ''; +$useCustom = false; + +// Custom Query Schutz +if ($customQuery) { + $forbidden = ['DELETE', 'UPDATE', 'INSERT', 'DROP', 'ALTER', 'TRUNCATE']; + $upper = strtoupper($customQuery); + + foreach ($forbidden as $bad) { + if (strpos($upper, $bad) !== false) { + echo "Gefährliche Query blockiert ($bad)"; + return; + } + } + + if (stripos(trim($customQuery), "SELECT") !== 0) { + echo "Nur SELECT erlaubt"; + return; + } + + $sql = $customQuery; + $useCustom = true; +} + +// Standard Queries +if (!$useCustom) { + switch ($filter) { + case 'today': + $sql = " + SELECT `CLIENT_IP`, `LAND`, `REQUEST_URL`, `COUNTER` + FROM logs + WHERE CLIENT_IP NOT IN ($devips_sql) + AND DATE(FIRST_REQUEST) = CURDATE() + ORDER BY FIRST_REQUEST DESC + "; + break; + + case 'counterperip': + $sql = " + SELECT CLIENT_IP, LAND, USER_AGENT, SUM(counter) AS gesamt_counter + FROM logs + WHERE CLIENT_IP NOT IN ($devips_sql) + GROUP BY CLIENT_IP + ORDER BY gesamt_counter DESC + "; + break; + + case 'node1': + $sql = " + SELECT `CLIENT_IP`, `LAND`, `REQUEST_URL`, `COUNTER` + FROM logs + WHERE `SERVER_IP` = 'node1' + ORDER BY `FIRST_REQUEST` DESC; + "; + break; + + case 'node2': + $sql = " + SELECT `CLIENT_IP`, `LAND`, `REQUEST_URL`, `COUNTER` + FROM logs + WHERE `SERVER_IP` = 'node2' + ORDER BY `FIRST_REQUEST` DESC; + "; + break; + + case 'node3': + $sql = " + SELECT `CLIENT_IP`, `LAND`, `REQUEST_URL`, `COUNTER` + FROM logs + WHERE `SERVER_IP` = 'node3' + ORDER BY `FIRST_REQUEST` DESC; + "; + break; + + case 'node4': + $sql = " + SELECT `CLIENT_IP`, `LAND`, `REQUEST_URL`, `COUNTER` + FROM logs + WHERE `SERVER_IP` = 'node4' + ORDER BY `FIRST_REQUEST` DESC; + "; + break; + + $sql = " + SELECT * + FROM logs + WHERE SERVER_IP = '$filter' + ORDER BY FIRST_REQUEST DESC + "; + break; + + default: + $sql = " + SELECT `CLIENT_IP`, `LAND`, `REQUEST_URL`, `COUNTER` + FROM logs + WHERE CLIENT_IP NOT IN ($devips_sql) + ORDER BY FIRST_REQUEST DESC + "; + } +} +?> + +

📊 Logs

+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +query($sql)) { + echo "
$sql
"; + + while ($row = $erg->fetch_object()) { + $daten[] = $row; + } +} +?> + + +Keine Daten gefunden + + +
+ + + $_): ?> + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/services/service3.php b/WEBROOT/services/service3.php similarity index 100% rename from services/service3.php rename to WEBROOT/services/service3.php diff --git a/services/services_control.php b/WEBROOT/services/services_control.php similarity index 100% rename from services/services_control.php rename to WEBROOT/services/services_control.php diff --git a/style.css b/WEBROOT/style.css similarity index 98% rename from style.css rename to WEBROOT/style.css index 434e319..0caf880 100644 --- a/style.css +++ b/WEBROOT/style.css @@ -47,6 +47,7 @@ header { .content { flex: 1; padding: 20px; + overflow: auto; } /* Dark Mode Styles */ @@ -54,21 +55,26 @@ body.dark-mode { background-color: #121212; color: #f0f0f0; } + body.dark-mode header { background-color: #1f1f1f; } + body.dark-mode .sidebar { background-color: #1a1a1a; border-right: 1px solid #333; } + body.dark-mode .sidebar button { background-color: #333; color: #f0f0f0; } + body.dark-mode .sidebar button.active { background-color: #007bff; color: white; } + body.dark-mode .content { background-color: #121212; } @@ -84,6 +90,7 @@ body.dark-mode .content { border: none; border-radius: 4px; } + body.dark-mode #darkModeToggle { background-color: #333; color: white; diff --git a/config.php b/config.php deleted file mode 100644 index 6485f74..0000000 --- a/config.php +++ /dev/null @@ -1,8 +0,0 @@ - ['name' => 'Service 1', 'active' => true], - 'service3' => ['name' => 'Service 2', 'active' => true], - 'request_chart' => ['name' => 'Request Logs', 'active' => true], - 'services_control' => ['name' => 'Services Control', 'active' => true], -]; -?> \ No newline at end of file diff --git a/services/request_chart.php b/services/request_chart.php deleted file mode 100644 index 60880fa..0000000 --- a/services/request_chart.php +++ /dev/null @@ -1,93 +0,0 @@ -connect_error) { - die("Verbindung fehlgeschlagen: " . $conn->connect_error); -} - -$sql = "SELECT DATE(FIRST_REQUEST) as tag, COUNT(*) as anzahl FROM logs GROUP BY DATE(FIRST_REQUEST) ORDER BY DATE(FIRST_REQUEST)"; -$result = $conn->query($sql); - -$labels = []; -$data = []; - -if ($result->num_rows > 0) { - while($row = $result->fetch_assoc()) { - $labels[] = $row['tag']; - $data[] = (int)$row['anzahl']; - } -} - -$conn->close(); -?> - - - - - - Logs Chart - - - - - - - - - - diff --git a/services/service2.php b/services/service2.php deleted file mode 100644 index 2ac53c5..0000000 --- a/services/service2.php +++ /dev/null @@ -1,2 +0,0 @@ -

Service 2

-

Dies ist der Inhalt von Service 2.