22 Commits
Author SHA1 Message Date
Tower 7b06eba5e0 critical fixes, delete all that is now in the backend 2026-08-24 18:31:45 +02:00
Tower 403e916794 changes 2026-07-16 20:35:20 +02:00
Bruno Eckhardt cece62b9b1 db fix 2026-07-13 14:24:54 +02:00
Tower decd7bcf50 update: add time in stundenplan 2026-02-22 18:03:00 +01:00
Tower 973ea32ff0 critical hotfix 2026-02-21 15:24:50 +01:00
Tower 5efb8c37eb update: logging 2026-02-21 15:07:20 +01:00
Tower 69bce401f4 hotfix 2026-02-21 14:44:51 +01:00
Tower 5c1e1a1a2e update cons 2026-02-21 14:41:08 +01:00
Tower e067c92fae update: logging 2026-02-21 14:03:56 +01:00
Bruno Eckhardt 973fd8d5cd fix 2026-02-05 15:40:22 +01:00
Tower 8a9caf2947 Merge branch 'Services' 2026-01-26 21:39:25 +01:00
Tower cce14ad6cb hotfix 2026-01-26 17:48:18 +01:00
Tower a23788ba7c Merge branch 'Controller' into Services 2026-01-22 11:31:47 +01:00
Tower 7410566fe6 Merge branch 'Services'
# Conflicts:
#	WEBROOT/services/test.php
2026-01-21 21:24:59 +01:00
Tower 7f9ca5ed66 Merge branch 'Controller' 2026-01-21 21:24:35 +01:00
Tower 8585af5cfe update: auth 2026-01-21 21:21:54 +01:00
Tower 1b74b1d06d Merge branch 'Dev-TEST'
# Conflicts:
#	WEBROOT/services/test.php
2026-01-21 17:43:44 +01:00
Tower 28cd7da655 update 2026-01-21 17:42:44 +01:00
Tower daae8892dc Merge branch 'Controller' 2026-01-21 14:06:45 +01:00
Tower 98f7b074d3 Merge branch 'Services' 2026-01-21 14:06:32 +01:00
Tower 8e722086ac delete unused print 2026-01-21 14:06:10 +01:00
Tower df3eb5541c update 2026-01-21 14:04:30 +01:00
29 changed files with 127 additions and 1080 deletions

No files matched your search

+33 -26
View File
@@ -50,19 +50,28 @@ class getSpecificData {
return $_SERVER['HTTP_REFERER'] ?? 'Unbekannt';
}
public function getWebsite(): string {
return $_SERVER['HTTP_HOST'] ?? 'Unbekannt';
}
public function getDatabase(): string {
$conn = db_connect();
return $conn->host_info;
}
public function getLoggingStatus($variable) {
include_once 'DatabaseController.php';
$status = DatabaseShow(
"Variablen",
"WERT",
"VARIABLENNAME = ?",
$variable
);
return $status;
}
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;
}
return $_SERVER['SERVER_NAME'] ?? 'Unbekannt';
}
public function getServerIP(): string {
@@ -94,9 +103,9 @@ class getSpecificData {
}
function getGeoIP($ClientIP) {
$whitelist = (new getSpecificData())->getWhitelistedIPs();
if (in_array($ClientIP, $whitelist)) {
if (in_array($ClientIP, ['0.0.0.0', '127.0.0.1', '172.30.0.1'])) {
return "Lokal";
} elseif (in_array($ClientIP, ['Unbekannt', '0.0.0.0', '127.0.0.1'])) {
return "Lokal";
} else {
$response = file_get_contents("http://ip-api.com/json/{$ClientIP}?fields=country,countryCode");
@@ -120,20 +129,7 @@ class getSpecificData {
}
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;
}
}
return $ServerIP;
}
function getClientStatus($ClientIP) {
@@ -143,8 +139,16 @@ class getSpecificData {
return "Untrusted";
}
function test() {
return "TEST";
function getIsAdmin(){
return $_SESSION['is_admin'] ?? false;
}
function getIsSuperuser(){
return $_SESSION['is_superuser'] ?? false;
}
function getUsername(){
return $_SESSION['username'] ?? 'Gast';
}
public function getAllData(): array {
@@ -170,6 +174,9 @@ class getSpecificData {
'Database' => $this->getDatabase(),
'Whitelisted Status' => $this->getClientStatus($this->getClientIP()),
'Whitelisted IPs' => $this->getWhitelistedIPs(),
'Website' => $this->getWebsite(),
'User Logging Status' => $this->getLoggingStatus('GENERAL_PUBLIC_LOGGING')[0]['WERT'],
'Dev Logging Status' => $this->getLoggingStatus('DEV_PUBLIC_LOGGING')[0]['WERT'],
];
}
+6 -7
View File
@@ -1,6 +1,7 @@
<?php
function db_connect() {
function db_connect()
{
$servers = [
'dev' => [
'hostaddr' => '10.233.1.29',
@@ -15,11 +16,11 @@ function db_connect() {
'database' => 'DEV',
],
'live' => [
'hostaddr' => '10.233.1.244',
'hostaddr' => '152.53.159.169',
'username' => 'worker',
'password' => 'bBHofurUJWKzPE8Z',
'database' => 'DEV',
]
'database' => 'LIVE',
],
];
$enviroment = 'live';
@@ -34,9 +35,7 @@ function db_connect() {
if ($conn->connect_error) {
throw new Exception('Connection Error: ' . $conn->connect_error);
}
$conn->set_charset("utf8mb4");
return $conn;
}
?>
+74 -65
View File
@@ -2,79 +2,88 @@
function logging() {
include_once 'DataController.php';
include_once 'DatabaseConnect.php';
include_once 'DatabaseController.php';
include_once 'DataController.php';
if ((new getSpecificData())->getLoggingStatus("GENERAL_PUBLIC_LOGGING")[0]['WERT'] == 'ON') {
$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());
$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());
$username = $_SESSION['username'] ?? 'Unbekannt';
$website = (new getSpecificData())->getWebsite();
if (in_array($ClientIP, $Whitelisted)) {
return;
}
if ((new getSpecificData())->getLoggingStatus("DEV_PUBLIC_LOGGING")[0]['WERT'] == 'OFF') {
if (in_array($ClientIP, $Whitelisted)) {
return;
}
}
$db_conn = db_connect();
$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` = ?
$stmt = $db_conn->prepare("SELECT * FROM logs WHERE
`CLIENT_IP` LIKE ? and
`REQUEST_URL` = ? and
`REQUEST_URL` <> '/favicon.ico'
");
$updateCounter->bind_param("ss", $ClientIP, $RequestURL);
$updateCounter->execute();
$stmt->bind_param("ss", $ClientIP, $RequestURL);
$stmt->execute();
$stmt->store_result();
$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
);
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, WEBSITE, USER",
$ClientIP,
$LAND,
$node,
$UserAgent,
$RequestURL,
$USERCOOKIE,
$SessionID,
$REQUESTTIME,
$QUERY,
$website,
$username
);
}
// ConsoleLog("Client IP: $ClientIP | User Agent: $UserAgent | Request URL: $RequestURL | User Cookie: $USERCOOKIE | Session ID: $SessionID | Request Time: $REQUESTTIME | GeoIP: $LAND | Server Node: $node | Website: $website");
}
}
}
+12
View File
@@ -1,4 +1,16 @@
<?php
ob_start();
// Vor allen includes, vor jeglicher Ausgabe
session_set_cookie_params([
'lifetime' => 0, // bis Browser geschlossen
'path' => '/', // Gültig für ganze Domain
'domain' => '', // aktuelle Domain
'secure' => false, // true nur für HTTPS
'httponly' => true,
'samesite' => 'Lax'
]);
session_start();
include_once 'controller/CookieController.php';
include_once 'controller/LogController.php';
include_once 'controller/DataController.php';
@@ -1,128 +0,0 @@
<?php
include_once '../../../controller/LogController.php';
logging();
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>Bericht hinzufügen</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f7f8;
margin: 0;
padding: 0;
}
.container {
max-width: 600px;
margin: 50px auto;
background: #fff;
padding: 30px;
border-radius: 12px;
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}
h2 {
text-align: center;
color: #333;
margin-bottom: 30px;
}
form label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: #555;
}
form input {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 8px;
box-sizing: border-box;
transition: border-color 0.3s;
}
form input:focus {
border-color: #007BFF;
outline: none;
}
button {
width: 100%;
padding: 12px;
background-color: #007BFF;
color: #fff;
border: none;
border-radius: 8px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #0056b3;
}
.form-group {
margin-bottom: 15px;
}
</style>
</head>
<body>
<div class="container">
<h2>Neuen Firmenbericht hinzufügen</h2>
<form action="../../../moduls/BerichteErstellenInsertModule.php" method="post">
<div class="form-group">
<label for="datum">Datum:</label>
<input type="date" id="datum" name="datum" required>
</div>
<div class="form-group">
<label for="p1">Prozess 1:</label>
<input type="text" id="p1" name="p1" required>
</div>
<div class="form-group">
<label for="p2">Prozess 2:</label>
<input type="text" id="p2" name="p2" required>
</div>
<div class="form-group">
<label for="p3">Prozess 3:</label>
<input type="text" id="p3" name="p3" required>
</div>
<div class="form-group">
<label for="p4">Prozess 4:</label>
<input type="text" id="p4" name="p4" required>
</div>
<div class="form-group">
<label for="beginn">Beginn:</label>
<input type="time" id="beginn" name="beginn" required>
</div>
<div class="form-group">
<label for="ende_real">Ende (real):</label>
<input type="time" id="ende_real" name="ende_real" required>
</div>
<button type="submit">Speichern</button>
</form>
</div>
</body>
</html>
@@ -1,138 +0,0 @@
<?php
include_once '../../../controller/LogController.php';
include_once '../../../controller/DatabaseConnect.php';
logging();
$conn = db_connect();
$corrections_file = __DIR__ . '/overtime_corrections.json';
// --- JSON-Korrektur laden ---
if (file_exists($corrections_file)) {
$corrections = json_decode(file_get_contents($corrections_file), true);
if (!is_array($corrections)) $corrections = [];
} else {
$corrections = ['plus' => 0, 'minus' => 0];
}
// --- Generelle Korrektur speichern ---
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$man_plus = intval($_POST['man_plus'] ?? 0);
$man_minus = intval($_POST['man_minus'] ?? 0);
$corrections = [
'plus' => $man_plus,
'minus' => $man_minus,
'total' => $man_plus - $man_minus
];
file_put_contents($corrections_file, json_encode($corrections, JSON_PRETTY_PRINT));
}
// --- Alle Firmenberichte aus DB laden ---
$daten = [];
$sql = "SELECT `DATUM`, `PROZESS_1`, `PROZESS_2`, `PROZESS_3`, `PROZESS_4`, `BEGINN`, `ENDE_REAL`, `ENDE_PUBLIC`, `OVERTIME` FROM Firmenberichte ORDER BY `DATUM` DESC";
if ($erg = $conn->query($sql)) {
while ($datensatz = $erg->fetch_object()) {
$daten[] = $datensatz;
}
$erg->free();
}
// --- Overtime-Summe berechnen ---
$gesamt_minuten = 0;
$time = "SELECT SUM(OVERTIME) AS db_minuten FROM Firmenberichte";
if ($erg = $conn->query($time)) {
$datensatz = $erg->fetch_object();
$gesamt_minuten = intval($datensatz->db_minuten);
}
// Generelle Korrektur hinzufügen
$gesamt_minuten += intval($corrections['total'] ?? 0);
// Stunden/Minuten
$stunden = intdiv($gesamt_minuten, 60);
$minuten = $gesamt_minuten % 60;
// Overtime-Objekt für Tabelle
$overtime = [
(object)[
'db_minuten' => intval($datensatz->db_minuten),
'plus' => $corrections['plus'] ?? 0,
'minus' => $corrections['minus'] ?? 0,
'gesamt_korrigiert'=> $gesamt_minuten,
'stunden' => $stunden,
'minuten' => $minuten
]
];
?>
<h1>Firmenberichte</h1>
<!-- Formular für generelle Korrektur -->
<form method="POST">
<h3>Generelle Stundenkorrektur für alle Berichte</h3>
<label>Plus-Minuten: </label>
<input type="number" name="man_plus" value=""><br>
<label>Minus-Minuten: </label>
<input type="number" name="man_minus" value=""><br><br>
<button type="submit">Speichern</button>
</form>
<hr>
<!-- Overtime Gesamtanzeige -->
<h2>Gesamte Overtime inkl. Korrektur</h2>
<div style="max-width:100%; overflow-x:auto;">
<table border="1" cellpadding="5" cellspacing="0"
style="border-collapse:collapse; width:100%; font-family:Arial; font-size:14px;">
<tr style="background:#f0f0f0; font-weight:bold;">
<th>DB-Minuten</th>
<th>Plus-Minuten</th>
<th>Minus-Minuten</th>
<th>Gesamt korrigiert</th>
<th>Stunden</th>
<th>Minuten</th>
</tr>
<?php foreach($overtime as $row): ?>
<tr>
<td style="padding:6px; word-break:break-word; white-space:normal;">
<?= htmlspecialchars($row->db_minuten ?? '') ?></td>
<td style="padding:6px; word-break:break-word; white-space:normal;">
<?= htmlspecialchars($row->plus ?? '') ?></td>
<td style="padding:6px; word-break:break-word; white-space:normal;">
<?= htmlspecialchars($row->minus ?? '') ?></td>
<td style="padding:6px; word-break:break-word; white-space:normal;">
<?= htmlspecialchars($row->gesamt_korrigiert ?? '') ?></td>
<td style="padding:6px; word-break:break-word; white-space:normal;">
<?= htmlspecialchars($row->stunden ?? '') ?></td>
<td style="padding:6px; word-break:break-word; white-space:normal;">
<?= htmlspecialchars($row->minuten ?? '') ?></td>
</tr>
<?php endforeach; ?>
</table>
</div>
<br>
<h2>Berichte im Detail</h2>
<div style="max-width:100%; overflow-x:auto;">
<table border="1" cellpadding="5" cellspacing="0"
style="border-collapse:collapse; width:100%; font-family:Arial; font-size:14px;">
<tr style="background:#f0f0f0; font-weight:bold;">
<?php
if (!empty($daten)) {
foreach ($daten[0] as $k => $v) {
echo "<th style='text-align:left; padding:6px; word-break:break-word; white-space:normal;'>".htmlspecialchars($k ?? '')."</th>";
}
}
?>
</tr>
<?php foreach ($daten as $bericht): ?>
<tr>
<?php foreach ($bericht as $v): ?>
<td style="padding:6px; word-break:break-word; white-space:normal; max-width:300px;">
<?= htmlspecialchars($v ?? '') ?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</table>
</div>
@@ -1,5 +0,0 @@
{
"plus": 0,
"minus": 960,
"total": -960
}
@@ -1,119 +0,0 @@
<?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>
-216
View File
@@ -1,216 +0,0 @@
<?php
include_once '../controller/LogController.php';
include_once '../controller/DatabaseConnect.php';
logging();
$conn = db_connect();
$devips = $Whitelisted = (new getSpecificData())->getWhitelistedIPs();
$devips_sql = "'" . implode("','", $devips) . "'";
echo "<h1>Datenbank auslesen um " . date("H:i:s") . "</h1>";
echo "<h2>Excluded:</h2>";
echo '<pre>';
print_r($devips_sql);
echo '</pre>';
echo '<br>';
$filter = $_GET['filter'] ?? 'alle';
$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 'today':
$sql = "
SELECT * 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`, `USER_AGENT`, `REQUEST_URL`, `USER_COOKIE_VALUE`, `FIRST_REQUEST`, `LAST_REQUEST`, `QUERY`, `COUNTER`
FROM logs
WHERE `SERVER_IP` = 'node1'
ORDER BY `FIRST_REQUEST` DESC;
";
break;
case 'node2':
$sql = "
SELECT `CLIENT_IP`, `LAND`, `USER_AGENT`, `REQUEST_URL`, `USER_COOKIE_VALUE`, `FIRST_REQUEST`, `LAST_REQUEST`, `QUERY`, `COUNTER`
FROM logs
WHERE `SERVER_IP` = 'node2'
ORDER BY `FIRST_REQUEST` DESC;
";
break;
case 'node3':
$sql = "
SELECT `CLIENT_IP`, `LAND`, `USER_AGENT`, `REQUEST_URL`, `USER_COOKIE_VALUE`, `FIRST_REQUEST`, `LAST_REQUEST`, `QUERY`, `COUNTER`
FROM logs
WHERE `SERVER_IP` = 'node3'
ORDER BY `FIRST_REQUEST` DESC;
";
break;
case 'node4':
$sql = "
SELECT `CLIENT_IP`, `LAND`, `USER_AGENT`, `REQUEST_URL`, `USER_COOKIE_VALUE`, `FIRST_REQUEST`, `LAST_REQUEST`, `QUERY`, `COUNTER`
FROM logs
WHERE `SERVER_IP` = 'node4'
ORDER BY `FIRST_REQUEST` DESC;
";
break;
case 'alle':
default:
$sql = "
SELECT * FROM `logs`
WHERE `CLIENT_IP` NOT IN ($devips_sql)
ORDER BY `FIRST_REQUEST` DESC
";
}
}
?>
<form method="GET">
<label><b>Log-Filter auswählen:</b></label>
<select name="filter" onchange="this.form.submit()">
<option value="alle" <?= $filter == 'alle' ? 'selected' : '' ?>>Alle Logs</option>
<option value="today" <?= $filter == 'today' ? 'selected' : '' ?>>Heute</option>
<option value="node1" <?= $filter == 'node1' ? 'selected' : '' ?>>Node 1</option>
<option value="node2" <?= $filter == 'node2' ? 'selected' : '' ?>>Node 2</option>
<option value="node3" <?= $filter == 'node3' ? 'selected' : '' ?>>Node 3</option>
<option value="node4" <?= $filter == 'node4' ? 'selected' : '' ?>>Node 4</option>
<option value="counterperip" <?= $filter == 'counterperip' ? 'selected' : '' ?>>Counter per IP</option>
</select>
</form>
<br>
<form method="POST">
<label><b>Eigene SELECT-Query ausführen:</b></label><br>
<textarea name="custom_query" style="width:1200px;height:60px;"><?= htmlspecialchars($customQuery) ?></textarea><br>
<button type="submit">Query ausführen</button>
</form>
<script>
document.addEventListener("DOMContentLoaded", () => {
const ta = document.querySelector("textarea[name='custom_query']");
const keywords = [
"select", "from", "where", "group", "by",
"is", "binary", "regexp", "any", "order",
"update", "delete", "create", "drop", "limit",
"null", "and", "or", "exists", "case",
"alter", "distinct", "having", "as", "on",
"not", "in", "union", "all", "like",
"some", "as", "by", "asc", "desc",
"outer", "inner", "left", "right", "join",
];
const regex = new RegExp("\\b(" + keywords.join("|") + ")\\b", "gi");
ta.addEventListener("input", () => {
let pos = ta.selectionStart; // Cursorposition merken
ta.value = ta.value.replace(regex, m => m.toUpperCase());
// Cursor zurücksetzen
ta.selectionStart = ta.selectionEnd = pos;
});
});
</script>
<br>
<hr>
<br>
<?php
$daten = [];
if ($erg = $conn->query($sql)) {
// Query schön anzeigen
echo "<b>Query:</b><br>";
echo "<div style='background:#f4f4f4; padding:10px; border-left:5px solid #007BFF; font-family:monospace; white-space:pre-wrap; word-wrap:break-word; max-width:1200px; overflow:auto;'>$sql</div><br>";
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;
?>
-78
View File
@@ -1,78 +0,0 @@
<?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>";
-83
View File
@@ -1,83 +0,0 @@
<!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>
-107
View File
@@ -1,107 +0,0 @@
<?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();
+2 -1
View File
@@ -6,7 +6,8 @@ include_once '../controller/DatabaseConnect.php';
$std = DatabaseShowWithFK(
"Stundenplan",
$Stundenplan,
// "MO"
"ZEITEN, MO, DI, MI, DO, FR"
);
$rows = $std['rows'];
-18
View File
@@ -1,18 +0,0 @@
<?php
include_once '../controller/UserController.php';
include_once '../controller/DatabaseController.php';
include_once '../controller/DatabaseConnect.php';
include_once '../moduls/ConsoleLog.php';
$kalender = DatabaseShow(
"Kalender",
"DATUM, EVENT",
"DATUM LIKE ?",
"%2026-02-%"
);
echo '<pre>';
print_r($kalender);
// WHERE EVENT LIKE '%Urlaub%' OR EVENT LIKE '%Gesetzlicher%' ORDER BY DATUM;";
-41
View File
@@ -1,41 +0,0 @@
<?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; ?>
@@ -6,26 +6,11 @@ $buttoncoloradmin = "#fd6a09ec";
$routing = "../../controller/RoutesController.php?website";
$buttons = [
["section" => "Datenbank Updaten", "buttons" => [
["name" => "Geo IPs Update", "link" => "$routing=/moduls/DatabaseLandUpdateModule.php", "color" => $buttoncoloractive],
]],
["section" => "Data Lookup", "buttons" => [
["name" => "Access Logs", "link" => "$routing=/services/DatabaseLogShow.php", "color" => $buttoncoloractive],
["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/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" => [
["name" => "Webshell", "link" => "$routing=/services/Webshell/", "color" => $buttoncolorinactive],
["name" => "Manuelles Mailing", "link" => "$routing=/services/ManualMailer/", "color" => $buttoncolorinactive],
]],
];
@@ -6,9 +6,6 @@ $buttoncoloradmin = "#fd6a09ec";
$routing = "../../controller/RoutesController.php?website";
$buttons = [
["section" => "3D Drucker", "buttons" => [
["name" => "Ender 3 V3 KE", "link" => "$routing=http://10.233.1.52/", "color" => $buttoncoloractive],
]],
["section" => "NAS1", "buttons" => [
["name" => "NAS1-Manager", "link" => "$routing=http://nas-1.blackpi.ipv64.net", "color" => $buttoncoloractive],
@@ -20,11 +17,6 @@ $buttons = [
["name" => "NAS2-Webserver", "link" => "$routing=http://10.233.1.22/", "color" => $buttoncoloractive],
]],
["section" => "Ubuntu-Server NAS", "buttons" => [
["name" => "Apache", "link" => "$routing=http://100.104.7.93", "color" => $buttoncoloractive],
["name" => "NAS-Manager", "link" => "$routing=http://100.104.7.93:9000", "color" => $buttoncoloractive],
]],
["section" => "Router", "buttons" => [
["name" => "FritzBox 7490", "link" => "$routing=http://fritzbox-1.blackpi.ipv64.net", "color" => $buttoncoloractive],
["name" => "FritzBox 7590", "link" => "$routing=http://fritzbox-2.blackpi.ipv64.net", "color" => $buttoncoloractive],
@@ -34,24 +26,8 @@ $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" => $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" => $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" => $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,16 +10,7 @@ $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" => "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" => [
["name" => "Etherwake", "link" => "../../GLOBAL/routes.php/?website=/Etherwake/", "color" => $buttoncolorinactive],
["name" => "FileServer", "link" => "../../GLOBAL/routes.php/?website=/Fileserver/", "color" => $buttoncolorinactive],
["name" => "PasswortManager", "link" => "../../GLOBAL/routes.php/?website=/PasswortManager/", "color" => $buttoncolorinactive],
["name" => "Blackpi-Webcam", "link" => "../../GLOBAL/routes.php/?website=/Webcam/", "color" => $buttoncolorinactive],
]],
];