init rest
This commit is contained in:
1 parent
ebb8e82c51
commit
a0674b2587
19 files changed
+1041
-125
No files matched your search
+73
@@ -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
|
||||||
|
|
||||||
@@ -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",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
$services = [
|
||||||
|
'service2' => ['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],
|
||||||
|
];
|
||||||
|
?>
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class cookieController {
|
||||||
|
|
||||||
|
public function setCookie(string $CookieName, int $CookieValue, int $CookieTime) {
|
||||||
|
setcookie($CookieName, $CookieValue, time()+($CookieTime*60));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function readCookieValue(string $CookieName) {
|
||||||
|
if (isset($_COOKIE[$CookieName])) {
|
||||||
|
return $_COOKIE[$CookieName];
|
||||||
|
}
|
||||||
|
return 'Cookie not set';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function DeleteCookie(string $CookieName) {
|
||||||
|
setcookie($CookieName, "", time()-(3600*24));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// USE:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cookie setzen:
|
||||||
|
* $cookieManager = new cookieController();
|
||||||
|
* $cookieManager->SetCookie("USER", "7", 60);
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cookie auslesen:
|
||||||
|
* $cookieValue = $cookieManager->readCookieValueCookie("USER");
|
||||||
|
* echo $cookieValue;
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cookie loeschen:
|
||||||
|
* $cookieManager->DeleteCookie("USER");
|
||||||
|
*/
|
||||||
@@ -0,0 +1,188 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class getSpecificData {
|
||||||
|
|
||||||
|
public function getUserAgent(): string {
|
||||||
|
return $_SERVER['HTTP_USER_AGENT'] ?? 'Unbekannt';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRequestURL(): string {
|
||||||
|
return $_SERVER['REQUEST_URI'] ?? 'Unbekannt';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCookie(string $name): ?string {
|
||||||
|
return $_COOKIE[$name] ?? 'Unbekannt';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getServerCookie(string $name): ?string {
|
||||||
|
return $_COOKIE[$name] ?? 'Unbekannt';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSessionID(): string {
|
||||||
|
return $session_id ?? 'Unbekannt ';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getServerPort(): string {
|
||||||
|
return $_SERVER['SERVER_PORT'] ?? 'Unbekannt';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClientPort(): string {
|
||||||
|
return $_SERVER['REMOTE_PORT'] ?? 'Unbekannt';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDocumentRoot(): string {
|
||||||
|
return $_SERVER['DOCUMENT_ROOT'] ?? 'Unbekannt';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getQuery(): string {
|
||||||
|
return $_SERVER['QUERY_STRING'] ?? 'Unbekannt';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRequestMethod(): string {
|
||||||
|
return $_SERVER['REQUEST_METHOD'] ?? 'Unbekannt';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCurrentDir(): string {
|
||||||
|
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;
|
||||||
|
|
||||||
|
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 "<pre>";
|
||||||
|
foreach ($SpecificData as $key => $value) {
|
||||||
|
if (is_array($value)) {
|
||||||
|
$value = implode(', ', $value);
|
||||||
|
}
|
||||||
|
printf("%-22s : %s\n", $key, $value);
|
||||||
|
}
|
||||||
|
echo "</pre>";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function db_connect() {
|
||||||
|
$servers = [
|
||||||
|
'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',
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -0,0 +1,177 @@
|
|||||||
|
<?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"]
|
||||||
|
];
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
function logging() {
|
||||||
|
include_once 'DatabaseConnect.php';
|
||||||
|
include_once 'DatabaseController.php';
|
||||||
|
include_once 'DataController.php';
|
||||||
|
|
||||||
|
$ClientIP = (new getSpecificData())->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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
include_once '../controller/LogController.php';
|
||||||
|
// logging();
|
||||||
|
|
||||||
|
if (!isset($_GET['website'])) {
|
||||||
|
die("Fehlender Parameter: website");
|
||||||
|
}
|
||||||
|
|
||||||
|
$website = trim($_GET['website']);
|
||||||
|
|
||||||
|
$blocked_schemes = ['javascript:', 'data:', 'file:'];
|
||||||
|
foreach ($blocked_schemes as $scheme) {
|
||||||
|
if (stripos($website, $scheme) === 0) {
|
||||||
|
die("Ungültige URL.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match('/^https?:\/\//i', $website)) {
|
||||||
|
header("Location: " . $website);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https://" : "http://";
|
||||||
|
$domain = $_SERVER['HTTP_HOST'];
|
||||||
|
|
||||||
|
$website = ltrim($website, "/");
|
||||||
|
|
||||||
|
$redirectUrl = $protocol . $domain . "/" . $website;
|
||||||
|
|
||||||
|
header("Location: " . $redirectUrl);
|
||||||
|
exit;
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
include 'config.php';
|
include 'config.php';
|
||||||
|
include_once './controller/CookieController.php';
|
||||||
|
include_once './controller/DatabaseConnect.php';
|
||||||
|
include_once './controller/DatabaseController.php';
|
||||||
|
include_once './controller/DataController.php';
|
||||||
|
include_once './controller/LogController.php';
|
||||||
|
// include_once './controller/RoutesController.php';
|
||||||
|
include_once './controller/UserController.php';
|
||||||
|
|
||||||
// Bestimme ausgewählten Service (default = erster aktiver Service)
|
// Bestimme ausgewählten Service (default = erster aktiver Service)
|
||||||
$selectedService = null;
|
$selectedService = null;
|
||||||
@@ -15,12 +22,14 @@ if (isset($_GET['service']) && isset($services[$_GET['service']]) && $services[$
|
|||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Service Website</title>
|
<title>Service Website</title>
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
Meine Services
|
Meine Services
|
||||||
@@ -29,13 +38,13 @@ if (isset($_GET['service']) && isset($services[$_GET['service']]) && $services[$
|
|||||||
<div class="main">
|
<div class="main">
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<?php foreach ($services as $key => $service): ?>
|
<?php foreach ($services as $key => $service): ?>
|
||||||
<?php if ($service['active']): ?>
|
<?php if ($service['active']): ?>
|
||||||
<a href="?service=<?php echo $key; ?>">
|
<a href="?service=<?php echo $key; ?>">
|
||||||
<button class="<?php echo $selectedService === $key ? 'active' : ''; ?>">
|
<button class="<?php echo $selectedService === $key ? 'active' : ''; ?>">
|
||||||
<?php echo $service['name']; ?>
|
<?php echo $service['name']; ?>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
@@ -50,22 +59,23 @@ if (isset($_GET['service']) && isset($services[$_GET['service']]) && $services[$
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const toggle = document.getElementById('darkModeToggle');
|
const toggle = document.getElementById('darkModeToggle');
|
||||||
const body = document.body;
|
const body = document.body;
|
||||||
|
|
||||||
// Prüfen, ob Dark Mode vorher aktiviert war
|
// Prüfen, ob Dark Mode vorher aktiviert war
|
||||||
if (localStorage.getItem('darkMode') === 'enabled') {
|
if (localStorage.getItem('darkMode') === 'enabled') {
|
||||||
body.classList.add('dark-mode');
|
body.classList.add('dark-mode');
|
||||||
|
}
|
||||||
|
|
||||||
|
toggle.addEventListener('click', () => {
|
||||||
|
body.classList.toggle('dark-mode');
|
||||||
|
if (body.classList.contains('dark-mode')) {
|
||||||
|
localStorage.setItem('darkMode', 'enabled');
|
||||||
|
} else {
|
||||||
|
localStorage.setItem('darkMode', 'disabled');
|
||||||
}
|
}
|
||||||
|
});
|
||||||
toggle.addEventListener('click', () => {
|
|
||||||
body.classList.toggle('dark-mode');
|
|
||||||
if (body.classList.contains('dark-mode')) {
|
|
||||||
localStorage.setItem('darkMode', 'enabled');
|
|
||||||
} else {
|
|
||||||
localStorage.setItem('darkMode', 'disabled');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
<?php
|
||||||
|
$servername = "testserver.blackpi.ipv64.net";
|
||||||
|
$username = "worker";
|
||||||
|
$password = "bBHofurUJWKzPE8Z";
|
||||||
|
$dbname = "DEV";
|
||||||
|
|
||||||
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||||
|
|
||||||
|
if ($conn->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();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Logs Chart</title>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<canvas id="logChart" width="600" height="400"></canvas>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const ctx = document.getElementById('logChart').getContext('2d');
|
||||||
|
const logChart = new Chart(ctx, {
|
||||||
|
type: 'line',
|
||||||
|
data: {
|
||||||
|
labels: <?php echo json_encode($labels); ?>,
|
||||||
|
datasets: [{
|
||||||
|
label: 'Logs pro Tag',
|
||||||
|
data: <?php echo json_encode($data); ?>,
|
||||||
|
borderColor: 'rgba(75, 192, 192, 1)',
|
||||||
|
backgroundColor: 'rgba(75, 192, 192, 0.2)',
|
||||||
|
fill: true,
|
||||||
|
tension: 0
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
responsive: true,
|
||||||
|
maintainAspectRatio: false,
|
||||||
|
plugins: {
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
text: 'Logs pro Tag'
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
display: true,
|
||||||
|
position: 'top'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
scales: {
|
||||||
|
x: {
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
text: 'Datum'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
y: {
|
||||||
|
min: 0,
|
||||||
|
max: 300,
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
text: 'Anzahl Logs'
|
||||||
|
},
|
||||||
|
ticks: {
|
||||||
|
stepSize: 20
|
||||||
|
},
|
||||||
|
beginAtZero: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
<?php
|
||||||
|
include_once '../controller/LogController.php';
|
||||||
|
include_once '../controller/DatabaseConnect.php';
|
||||||
|
|
||||||
|
$conn = db_connect();
|
||||||
|
|
||||||
|
// Dev-IPs
|
||||||
|
$devips = (new getSpecificData())->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 "<b style='color:red'>Gefährliche Query blockiert ($bad)</b>";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stripos(trim($customQuery), "SELECT") !== 0) {
|
||||||
|
echo "<b style='color:red'>Nur SELECT erlaubt</b>";
|
||||||
|
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
|
||||||
|
";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h1>📊 Logs</h1>
|
||||||
|
|
||||||
|
<form method="GET">
|
||||||
|
<select name="filter" onchange="this.form.submit()">
|
||||||
|
<?php
|
||||||
|
$options = ['alle','today','node1','node2','node3','node4','counterperip'];
|
||||||
|
foreach ($options as $opt) {
|
||||||
|
$sel = $filter === $opt ? 'selected' : '';
|
||||||
|
echo "<option value='$opt' $sel>$opt</option>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<form method="POST">
|
||||||
|
<textarea name="custom_query" style="width:100%;height:60px;"><?= htmlspecialchars($customQuery) ?></textarea>
|
||||||
|
<br>
|
||||||
|
<button type="submit">Query ausführen</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$daten = [];
|
||||||
|
|
||||||
|
if ($erg = $conn->query($sql)) {
|
||||||
|
echo "<pre style='background:var(--bg-soft,#f4f4f4);padding:10px;'>$sql</pre>";
|
||||||
|
|
||||||
|
while ($row = $erg->fetch_object()) {
|
||||||
|
$daten[] = $row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php if (!$daten): ?>
|
||||||
|
<b>Keine Daten gefunden</b>
|
||||||
|
<?php else: ?>
|
||||||
|
|
||||||
|
<div style="overflow-x:auto;">
|
||||||
|
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse;width:100%;">
|
||||||
|
<tr>
|
||||||
|
<?php foreach ($daten[0] as $key => $_): ?>
|
||||||
|
<th><?= htmlspecialchars($key) ?></th>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php foreach ($daten as $row): ?>
|
||||||
|
<tr>
|
||||||
|
<?php foreach ($row as $val): ?>
|
||||||
|
<td><?= htmlspecialchars($val ?? '') ?></td>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php endif; ?>
|
||||||
File renamed without changes.
File renamed without changes.
@@ -47,6 +47,7 @@ header {
|
|||||||
.content {
|
.content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dark Mode Styles */
|
/* Dark Mode Styles */
|
||||||
@@ -54,21 +55,26 @@ body.dark-mode {
|
|||||||
background-color: #121212;
|
background-color: #121212;
|
||||||
color: #f0f0f0;
|
color: #f0f0f0;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.dark-mode header {
|
body.dark-mode header {
|
||||||
background-color: #1f1f1f;
|
background-color: #1f1f1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.dark-mode .sidebar {
|
body.dark-mode .sidebar {
|
||||||
background-color: #1a1a1a;
|
background-color: #1a1a1a;
|
||||||
border-right: 1px solid #333;
|
border-right: 1px solid #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.dark-mode .sidebar button {
|
body.dark-mode .sidebar button {
|
||||||
background-color: #333;
|
background-color: #333;
|
||||||
color: #f0f0f0;
|
color: #f0f0f0;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.dark-mode .sidebar button.active {
|
body.dark-mode .sidebar button.active {
|
||||||
background-color: #007bff;
|
background-color: #007bff;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.dark-mode .content {
|
body.dark-mode .content {
|
||||||
background-color: #121212;
|
background-color: #121212;
|
||||||
}
|
}
|
||||||
@@ -84,6 +90,7 @@ body.dark-mode .content {
|
|||||||
border: none;
|
border: none;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.dark-mode #darkModeToggle {
|
body.dark-mode #darkModeToggle {
|
||||||
background-color: #333;
|
background-color: #333;
|
||||||
color: white;
|
color: white;
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<?php
|
|
||||||
$services = [
|
|
||||||
'service2' => ['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],
|
|
||||||
];
|
|
||||||
?>
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
<?php
|
|
||||||
$servername = "testserver.blackpi.ipv64.net";
|
|
||||||
$username = "worker";
|
|
||||||
$password = "bBHofurUJWKzPE8Z";
|
|
||||||
$dbname = "DEV";
|
|
||||||
|
|
||||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
|
||||||
|
|
||||||
if ($conn->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();
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="de">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>Logs Chart</title>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<canvas id="logChart" width="600" height="400"></canvas>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
const ctx = document.getElementById('logChart').getContext('2d');
|
|
||||||
const logChart = new Chart(ctx, {
|
|
||||||
type: 'line',
|
|
||||||
data: {
|
|
||||||
labels: <?php echo json_encode($labels); ?>,
|
|
||||||
datasets: [{
|
|
||||||
label: 'Logs pro Tag',
|
|
||||||
data: <?php echo json_encode($data); ?>,
|
|
||||||
borderColor: 'rgba(75, 192, 192, 1)',
|
|
||||||
backgroundColor: 'rgba(75, 192, 192, 0.2)',
|
|
||||||
fill: true,
|
|
||||||
tension: 0
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
responsive: true,
|
|
||||||
maintainAspectRatio: false,
|
|
||||||
plugins: {
|
|
||||||
title: {
|
|
||||||
display: true,
|
|
||||||
text: 'Logs pro Tag'
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
display: true,
|
|
||||||
position: 'top'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
scales: {
|
|
||||||
x: {
|
|
||||||
title: {
|
|
||||||
display: true,
|
|
||||||
text: 'Datum'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
y: {
|
|
||||||
min: 0,
|
|
||||||
max: 300,
|
|
||||||
title: {
|
|
||||||
display: true,
|
|
||||||
text: 'Anzahl Logs'
|
|
||||||
},
|
|
||||||
ticks: {
|
|
||||||
stepSize: 20
|
|
||||||
},
|
|
||||||
beginAtZero: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
<h2>Service 2</h2>
|
|
||||||
<p>Dies ist der Inhalt von Service 2.</p>
|
|
||||||
Reference in new issue
Block a user