First version, for githup; UNSTABLE, DO NOT USE!

This commit is contained in:
Fabio Herzig
2026-04-12 21:25:44 +02:00
commit a51fd9dbeb
423 changed files with 58560 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
<?php
header('Content-Type: application/json');
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if (session_status() !== PHP_SESSION_ACTIVE) session_start();
if (empty($_SESSION['access_granted_wk_leitung']) || $_SESSION['access_granted_wk_leitung'] !== true || empty($_SESSION['passcodewk_leitung_id']) || intval($_SESSION['passcodewk_leitung_id']) < 0 ) {
http_response_code(403);
exit;
}
$token = isset($_GET['token']) ? $_GET['token'] : '';
if ($token !== 'bKqBAPjwojZdarJaE7jwvRrIEf2WzJUlFlufQadfLJ98qJcrWZK5pRlGoUQOHp1L06urGRbEdE9v5oIRirPiUCjm93wATghO4qx'){
echo json_encode(['success' => false, 'message' => '500 Error - Critical Server Error']);
exit;
}
if (!isset($baseDir)) {
$baseDir = $_SERVER['DOCUMENT_ROOT'];
}
$type = 'wkl';
$data = include $baseDir . '/../scripts/db/db-verbindung-script.php';
if ($data['success'] === false){
echo json_encode(['success' => false, 'message' => $data['message']]);
exit;
}
require $baseDir . '/../scripts/db/db-tables.php';
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
if ($id <= 0) {
echo json_encode(['success' => false, 'message' => 'Invalid ID']);
exit;
}
// ---------- Step 2: Get values from DB ----------
$stmt = $mysqli->prepare("DELETE FROM `$tableProgramme` WHERE id = ?");
if (!$stmt) {
echo json_encode(['success' => false, 'message' => 'Critical DB ERROR']);
exit;
}
$stmt->bind_param("i", $id);
$success = $stmt->execute();
$stmt->close();
if (!$success) {
echo json_encode(['success' => false, 'message' => 'Insert failed']);
exit;
}
// Fetch all rows
$query2 = "SELECT * FROM `$tableProgramme` ORDER BY programm ASC";
$programme = $mysqli->query($query2);
if (!$programme) {
echo json_encode(['success' => false, 'message' => 'Select failed']);
exit;
}
$output = [];
while ($entry = $programme->fetch_assoc()) {
$output[] = [
'id' => $entry['id'],
'programm' => $entry['programm'],
'aktiv' => intval($entry['aktiv']),
'preis' => floatval($entry['preis'])
];
}
// Return JSON
echo json_encode([
'success' => true,
'output' => $output,
'message' => $id.' gelöscht'
]);
exit;