48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
ini_set('display_errors', 1);
|
|
error_reporting(E_ALL);
|
|
|
|
require_once "config/config.php";
|
|
include("Data.class.php");
|
|
$Data = new Data($pdo);
|
|
require_once "config/session.php";
|
|
|
|
if (!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true) {
|
|
header("location: index.php");
|
|
exit;
|
|
}
|
|
|
|
if (!isset($_SESSION['role']) || $_SESSION['role'] !== 'admin') {
|
|
http_response_code(403);
|
|
exit("Keine Berechtigung");
|
|
}
|
|
|
|
if (!isset($_POST["id"])) {
|
|
die("Kein Termin angegeben.");
|
|
}
|
|
|
|
$id = intval($_POST["id"]);
|
|
|
|
$Data->deleteCalendarEvent($id);
|
|
|
|
// --------------------------------------------------
|
|
// 2) Changelog löschen
|
|
// --------------------------------------------------
|
|
$pdo->prepare("DELETE FROM changes WHERE termin_id = :id")
|
|
->execute([':id' => $id]);
|
|
|
|
//$Data->createChanges($id, $_SESSION["id"], "delete", "", "");
|
|
|
|
// --------------------------------------------------
|
|
// 3) Termin löschen
|
|
// --------------------------------------------------
|
|
$pdo->prepare("DELETE FROM termine WHERE id = :id")
|
|
->execute([':id' => $id]);
|
|
|
|
|
|
// --------------------------------------------------
|
|
// Weiterleitung
|
|
// --------------------------------------------------
|
|
header("Location: termine.php");
|
|
exit;
|