20 Commits

Author SHA1 Message Date
5f3ac9f78d Merge branch 'frontendBackendFinal' of https://git.bib.de/PBBFA23CSE/Bib-Arts into frontendBackendFinal 2025-07-08 10:29:03 +02:00
775b752d59 News-Admin-Workflow aufgebohrt:
- News können jetzt als Admin  erstellt und gelöscht werden, mit Zwischenseite zur Bestätigung.
- Fehler bei den Feldnamen im Model gefixt.
- Nach dem Anlegen/Löschen gibt’s jetzt wie beim Login/Registrieren eine kurze Erfolgsmeldung und automatischen Redirect.
- Includes und Redirects aufgeräumt, damit keine Warnungen mehr kommen.
2025-07-08 10:12:07 +02:00
3faec473ef Added Styles to Create and Update Event 2025-07-07 20:32:35 +02:00
a9944259b6 vorlage für create und update für event gemacht. 2025-07-07 14:50:05 +02:00
4f0f1e5f6d Navigationsleiste angepasst, je nach login zustand 2025-07-07 14:40:55 +02:00
e68c86c93e Merge branch 'frontendBackendFinal' of https://git.bib.de/PBBFA23CSE/Bib-Arts into frontendBackendFinal 2025-07-07 14:38:36 +02:00
a9997b3c63 Registrierung und Login aufgeräumt: Felder und Fehler angepasst, Formulardaten bleiben bei Fehlern erhalten, Navigation zeigt jetzt nur noch passende Links je nach Login-Status, Passwort-Fehler verständlich auf Deutsch. Alles einheitlich und benutzerfreundlich gemacht! 2025-07-07 14:31:32 +02:00
9ce7a6cfd3 fixed infos 2025-07-07 14:26:26 +02:00
ca757d1723 Merge branch 'frontendBackendFinal' of https://git.bib.de/PBBFA23CSE/Bib-Arts into frontendBackendFinal 2025-07-07 14:22:53 +02:00
717d361dbb showNews angebindet und zum laufen gebracht. 2025-07-07 14:19:52 +02:00
404e846418 logout von form zu button mit get request geändert 2025-07-07 12:46:49 +02:00
3ce61ace17 "Zwischen-Views" erstellt für Weiterleitung nach Login/Logout. Views einheitlich im div container class="inhalt". Error message nach fehlerhaftem login. 2025-07-07 12:43:25 +02:00
3dc68dd0bc forgot pw try to fix 2025-07-07 11:24:11 +02:00
b9fc6bcdd5 fixed Registration 2025-07-07 11:20:57 +02:00
a50b48592b fixed event 2025-07-07 11:15:49 +02:00
1691370db6 Merge branch 'frontendBackendFinal' of https://git.bib.de/PBBFA23CSE/Bib-Arts into frontendBackendFinal 2025-07-07 11:04:31 +02:00
a6b672ee7e Refactor Controller and models anhand der bibarts.sql und unbrauchbare Controllers und Models entfernt. 2025-07-07 11:03:59 +02:00
97c03d817e Initiales .sql script angepasst 2025-07-07 11:03:51 +02:00
877be4e567 Login Form updated 2025-07-07 11:01:54 +02:00
ef3349c6e4 fixed login and register with right linktos 2025-07-07 10:42:58 +02:00
39 changed files with 783 additions and 526 deletions

View File

@@ -150,32 +150,63 @@ a {
border-radius: 10px;
}
.login-container {
position: absolute;
top: 200px;
.form-container {
background-color: #BAC8D4;
width: 900px;
height: 450px;
width: 100%;
max-width: 400px;
border-radius: 10px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 32px 24px 24px 24px;
margin: 32px auto;
}
.tickets-container {
position: absolute;
top: 200px;
background-color: #BAC8D4;
width: 900px;
height: 450px;
border-radius: 10px;
.form-horizontal {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 12px;
margin-bottom: 10px;
}
.form-horizontal label {
margin-bottom: 2px;
}
.form-horizontal input[type="text"],
.form-horizontal input[type="email"],
.form-horizontal input[type="password"] {
width: 100%;
padding: 8px 10px;
border: 1px solid #BAC8D4;
border-radius: 4px;
font-size: 1rem;
box-sizing: border-box;
background: #fff;
}
.form-horizontal button {
width: 100%;
padding: 10px 0;
border: none;
border-radius: 4px;
background: #4d4d4d;
color: #fff;
font-size: 1rem;
margin-top: 8px;
cursor: pointer;
transition: background 0.2s;
}
.form-horizontal button:hover {
background: #333;
}
.login-error, .form-error {
background: #ffe0e0;
color: #b30000;
border: 1px solid #ffb3b3;
border-radius: 6px;
padding: 10px 16px;
margin-bottom: 18px;
width: 100%;
text-align: center;
}
@media (max-width: 600px) {
@@ -297,7 +328,7 @@ a {
padding: 16px 8px;
box-sizing: border-box;
}
.tickets-container {
.event-container {
position: static;
width: 95vw;
max-width: 400px;
@@ -310,7 +341,7 @@ a {
font-size: 1.5em;
text-align: center;
}
.tickets-container h1 {
.event-container h1 {
font-size: 1.5em;
text-align: center;
}
@@ -374,4 +405,114 @@ a {
.nav-links .links {
margin: 0 12px;
}
}
/* Tabellen-Design */
table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
background: #fff;
border-radius: 10px;
box-shadow: 0 2px 12px rgba(0,0,0,0.07);
margin: 24px 0;
overflow: hidden;
}
thead th {
background: #BAC8D4;
color: #222;
font-weight: 600;
padding: 12px 8px;
text-align: left;
border-bottom: 2px solid #e0e0e0;
}
tbody td {
padding: 10px 8px;
border-bottom: 1px solid #f0f0f0;
vertical-align: top;
}
tbody tr:last-child td {
border-bottom: none;
}
tbody tr:hover {
background: #f5faff;
}
.admin-btn, .admin-btn:visited {
display: inline-block;
background: #4d4d4d;
color: #fff;
border-radius: 5px;
padding: 7px 16px;
margin: 8px 0 12px 0;
text-decoration: none;
font-size: 1em;
font-weight: 500;
transition: background 0.2s;
}
.admin-btn:hover {
background: #222;
color: #fff;
}
td a {
color: #09add0;
text-decoration: underline;
margin: 0 4px;
font-size: 0.98em;
}
td a:hover {
color: #007b9e;
}
.news-cards {
display: flex;
flex-wrap: wrap;
gap: 24px;
justify-content: flex-start;
margin: 24px 0;
}
.news-card {
background: #fff;
border-radius: 12px;
box-shadow: 0 2px 12px rgba(0,0,0,0.08);
padding: 20px 18px 16px 18px;
max-width: 340px;
min-width: 220px;
flex: 1 1 300px;
display: flex;
flex-direction: column;
justify-content: space-between;
margin: 0;
}
.news-card h3 {
margin: 0 0 8px 0;
font-size: 1.2em;
color: #222;
}
.news-card .news-date {
font-size: 0.95em;
color: #888;
margin-bottom: 10px;
}
.news-card .news-desc {
font-size: 1em;
color: #333;
margin-bottom: 14px;
white-space: pre-line;
}
.news-card .admin-btn {
align-self: flex-end;
margin: 0 0 0 8px;
padding: 6px 12px;
font-size: 0.97em;
}
@media (max-width: 700px) {
.news-cards {
flex-direction: column;
gap: 16px;
}
.news-card {
max-width: 98vw;
min-width: unset;
width: 100%;
}
}

View File

@@ -47,30 +47,31 @@ class AuthController
$password = $_POST['password'];
$result = $this->model->login($email, $password);
if ($result === true) {
$_SESSION['user'] = $email;
header('Location: /bibarts/?controller=News&do=showNews');
exit();
if ($result['success']) {
$_SESSION['user'] = $result['user']['email'];
$_SESSION['is_admin'] = $result['user']['is_admin'];
$this->view->setDoMethodName('showLoginSuccess');
} else {
$this->view->setVars([
'errors' => ['login' => is_string($result) ? $result : "Login fehlgeschlagen."],
'errors' => ['login' => $result['error']],
'validData' => ['email' => $email],
'loginSuccess' => false
]);
$this->view->setDoMethodName('showLoginForm');
}
}
public function register() {
$data = [
'first_name' => $_POST['vorname'] ?? '',
'last_name' => $_POST['nachname'] ?? '',
'street' => $_POST['strasse'] ?? '',
'house_number' => $_POST['hausnr'] ?? '',
'postal_code' => $_POST['plz'] ?? '',
'city' => $_POST['ort'] ?? '',
'country' => $_POST['land'] ?? '',
'phone' => $_POST['tel'] ?? '',
'first_name' => $_POST['first_name'] ?? '',
'last_name' => $_POST['last_name'] ?? '',
'street' => $_POST['street'] ?? '',
'house_number' => $_POST['house_number'] ?? '',
'postal_code' => $_POST['postal_code'] ?? '',
'city' => $_POST['city'] ?? '',
'country' => $_POST['country'] ?? '',
'phone' => $_POST['phone'] ?? '',
'email' => $_POST['email'] ?? '',
'password' => $_POST['password'] ?? '',
'password_repeat' => $_POST['password_repeat'] ?? '',
@@ -80,14 +81,15 @@ class AuthController
$result = $this->model->register($data);
if ($result === true) {
$this->view->setVars(['success' => 'Registrierung erfolgreich!']);
$this->view->render('Auth/showLoginForm');
exit;
$this->view->setDoMethodName('showRegistrationSuccess');
} else {
$errors['register'] = is_string($result) ? $result : "Registrierung fehlgeschlagen.";
if (is_array($result)) {
$errors['register'] = implode('<br>', $result);
} else {
$errors['register'] = is_string($result) ? $result : "Registrierung fehlgeschlagen.";
}
$this->view->setVars(['errors' => $errors, 'validData' => $data]);
$this->view->render('Auth/showRegistrationForm');
exit;
$this->view->setDoMethodName('showRegistrationForm');
}
}
@@ -128,8 +130,7 @@ class AuthController
}
}
public function showConfirmation()
{
public function showConfirmation() {
$messages = [
'login' => "Login erfolgreich.",
'register' => "Registrierung erfolgreich.",
@@ -145,7 +146,6 @@ class AuthController
public function logout() {
unset($_SESSION['user']);
session_destroy();
header('Location: /bibarts/?controller=Auth&do=showLoginForm');
exit();
$this->view->setDoMethodName('showLogoutSuccess');
}
}

View File

@@ -1,53 +0,0 @@
<?php
namespace Blog\Controller;
use Blog\Model\ContactModel;
class ContactController
{
protected $view;
private $db;
private $validData = array();
private $errors = array();
private $labels = array("name" => "Name", "email" => "E-Mail-Adresse", "content" => "Nachricht");
public function __construct($view) {
$this->db = new ContactModel();
$this->view = $view;
}
public function showContactForm() {
$this->view->setVars([
'labels' => $this->labels,
'validData' => $this->validData,
'errors' => $this->errors
]);
}
public function showConfirmation() {
}
public function validateForm() {
foreach ($this->labels as $index => $value) {
if (!isset($_POST[$index]) || empty($_POST[$index])) {
$this->errors[$index] = "Bitte " . $value . " angeben";
} else {
$this->validData[$index] = $_POST[$index];
}
}
if (count($this->errors) > 0) {
$this->view->setDoMethodName("showContactForm");
$this->showContactForm();
} else {
if ($this->db->writeContactData($this->validData)) {
$this->view->setDoMethodName("showConfirmation");
$this->showConfirmation();
}
}
}
}
?>

View File

@@ -3,6 +3,7 @@
namespace Blog\Controller;
use Blog\Model\EventModel;
use Blog\Model\StandortModel;
class EventController {
@@ -61,4 +62,40 @@ class EventController {
$this->model->deleteEvent($id);
$this->view->setVars(['id' => $id]);
}
public function showUpdateEvent() {
$id = $_GET['event_id'] ?? null;
if (!$id) {
// handle error, e.g., redirect or show error message
$this->view->setVars(['error' => 'Keine Event-ID angegeben.']);
return;
}
$event = $this->model->getEvent($id);
if (!$event) {
$this->view->setVars(['error' => 'Event nicht gefunden.']);
return;
}
// Map DB fields to view fields if needed
$eventView = [
'id' => $event['event_id'],
'name' => $event['name'],
'start_date' => $event['start_date'],
'end_date' => $event['end_date'],
'location_id' => $event['location_id'],
'description' => $event['description'],
'max_tickets' => $event['max_tickets'],
'ticket_price' => $event['ticket_price'],
];
// Fetch location name (city)
$standortModel = new StandortModel();
$location = $standortModel->getStandort($event['location_id']);
$eventView['location_name'] = $location['city'] ?? '';
$this->view->setVars(['event' => $eventView]);
}
public function showCreateEvent() {
$standortModel = new \Blog\Model\StandortModel();
$locations = $standortModel->getStandorte();
$this->view->setVars(['locations' => $locations]);
}
}

View File

@@ -20,14 +20,38 @@ class NewsController {
}
public function createNews() {
if (!isset($_SESSION['is_admin']) || !$_SESSION['is_admin']) {
header('Location: index.php?controller=News&do=showNews');
exit;
}
$data = [
'name' => $_POST['name'],
'beschreibung' => $_POST['beschreibung'],
'datum' => $_POST['datum'],
'name' => $_POST['name'] ?? '',
'description' => $_POST['description'] ?? '',
'date' => $_POST['date'] ?? date('Y-m-d'),
];
$erg = $this->model->createNews($data);
$this->view->setVars(['news' => $erg]);
exit;
$errors = [];
if (empty($data['name']) || empty($data['description']) || empty($data['date'])) {
$errors['news'] = 'Bitte alle Felder ausfüllen.';
}
if (!empty($errors)) {
$this->view->setVars(['errors' => $errors, 'validData' => $data]);
$this->view->setDoMethodName('createNewsForm');
return;
}
$this->model->createNews($data);
$this->view->setDoMethodName('showCreateSuccess');
}
public function createNewsForm() {
if (!isset($_SESSION['is_admin']) || !$_SESSION['is_admin']) {
header('Location: index.php?controller=News&do=showNews');
exit;
}
// Leere Felder für das Formular
$this->view->setVars([
'errors' => [],
'validData' => []
]);
}
public function editNewsForm() {
@@ -47,7 +71,14 @@ class NewsController {
}
public function deleteNews() {
$id = $_GET['newsid'] ?? null;
$this->model->deleteNews($id);
if (!isset($_SESSION['is_admin']) || !$_SESSION['is_admin']) {
header('Location: index.php?controller=News&do=showNews');
exit;
}
$id = $_GET['id'] ?? null;
if ($id) {
$this->model->deleteNews($id);
}
$this->view->setDoMethodName('showDeleteSuccess');
}
}

View File

@@ -1,10 +0,0 @@
<?php
namespace Blog\Controller;
class RegisterController {
function showRegisterPage()
{
}
}

View File

@@ -1,18 +0,0 @@
<?php
namespace Blog\Controller;
class WelcomeController
{
function showWelcome() {
}
function showProjects() {
}
function showTutorials() {
}
}

View File

@@ -11,7 +11,7 @@ class AuthModel extends Database
public function login(string $email, string $password)
{
$pdo = $this->linkDB();
$sql = "SELECT email, password, valid_until FROM user WHERE email = :email";
$sql = "SELECT email, password, valid_until, is_admin FROM user WHERE email = :email";
$params = [":email" => $email];
try {
@@ -20,15 +20,15 @@ class AuthModel extends Database
$user = $sth->fetch(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Abrufen der Benutzerdaten.", $e);
return "Interner Datenbankfehler."; // Nur für Debug sichtbar machen, sonst besser allgemein halten
return ['success' => false, 'error' => "Interner Datenbankfehler."];
}
if (!$user) {
return "Benutzer mit dieser E-Mail wurde nicht gefunden.";
return ['success' => false, 'error' => "Benutzer mit dieser E-Mail wurde nicht gefunden."];
}
if (!password_verify($password, $user['password'])) {
return "Das eingegebene Passwort ist falsch.";
return ['success' => false, 'error' => "Das eingegebene Passwort ist falsch."];
}
try {
@@ -36,14 +36,14 @@ class AuthModel extends Database
$validUntil = new DateTime($user['valid_until']);
if ($now > $validUntil) {
return "Ihr Passwort ist abgelaufen. Bitte setzen Sie ein neues über \"Passwort vergessen\".";
return ['success' => false, 'error' => "Ihr Passwort ist abgelaufen. Bitte setzen Sie ein neues über \"Passwort vergessen\"."];
}
} catch (\Exception $e) {
new \Blog\Library\ErrorMsg("Fehler beim Verarbeiten des Gültigkeitsdatums.", $e);
return "Fehler bei der Passwortprüfung.";
return ['success' => false, 'error' => "Fehler bei der Passwortprüfung."];
}
return true;
return ['success' => true, 'user' => $user];
}
public function register($data) {
@@ -52,7 +52,7 @@ class AuthModel extends Database
}
$requiredFields = [
'email', 'password', 'street', 'house_number', 'city', 'postal_code',
'email', 'password', 'password_repeat', 'street', 'house_number', 'city', 'postal_code',
'country', 'first_name', 'last_name', 'phone'
];
@@ -71,8 +71,9 @@ class AuthModel extends Database
return "Passwörter stimmen nicht überein.";
}
if ($this->pwRequirementCheck($data['password']) !== true) {
return "Passwort muss mindestens 8 Zeichen lang sein und mindestens ein Großbuchstabe, ein Kleinbuchstabe, eine Zahl und ein Sonderzeichen enthalten.";
$pwCheck = $this->pwRequirementCheck($data['password']);
if ($pwCheck !== true) {
return $pwCheck; // Array mit spezifischen Fehlern zurückgeben
}
$hashedPassword = password_hash($data['password'], PASSWORD_DEFAULT);
@@ -220,16 +221,16 @@ class AuthModel extends Database
public function pwRequirementCheck($password){
$error = [];
if(strlen($password) <= 8)
$error[] = "min 8 Charackter";
if(strlen($password) < 8)
$error[] = "Passwort: mindestens 8 Zeichen";
if(!preg_match("/[A-Z]/", $password))
$error[] = "min one large Character";
$error[] = "Passwort: mindestens ein Großbuchstabe";
if(!preg_match("/[a-z]/", $password))
$error[] = "min one small charakter";
$error[] = "Passwort: mindestens ein Kleinbuchstabe";
if(!preg_match("/[0-9]/", $password))
$error[] = "min one number";
if(!preg_match("[^a-zA-Z0-9\s]", $password));
$error[] = "min one special character";
$error[] = "Passwort: mindestens eine Zahl";
if(!preg_match("/[^a-zA-Z0-9\s]/", $password))
$error[] = "Passwort: mindestens ein Sonderzeichen";
if(empty($error))
return true;

View File

@@ -1,31 +0,0 @@
<?php
namespace Blog\Model;
use PDOException;
class ContactModel extends Database
{
public function writeContactData($values)
{
$guid = $this->createUUID();
$sql = "INSERT INTO contact (`id`, `name`, `email`, `content`) VALUES (
:guid, :name, :email, :content);";
$pdo = $this->linkDB();
try {
$sth = $pdo->prepare($sql);
$sth->execute(array(":guid" => $guid,
":name" => $values["name"],
":email" => $values["email"],
":content" => $values["content"]));
} catch (PDOException $e) {
new \Blog\Library\ErrorMsg("Fehler beim Schreiben der Daten.", $e);
die;
}
return true;
}
}

View File

@@ -8,7 +8,7 @@ class EventModel extends Database {
public function getEvents() {
$pdo = $this->linkDB();
$sql = "SELECT * FROM ausstellung ORDER BY datum_von DESC;";
$sql = "SELECT * FROM event ORDER BY start_date DESC;";
try {
$sth = $pdo->prepare($sql);
$sth->execute();
@@ -21,7 +21,7 @@ class EventModel extends Database {
public function getEvent($id) {
$pdo = $this->linkDB();
$sql = "SELECT * FROM ausstellung WHERE ausstellungid = :id;";
$sql = "SELECT * FROM event WHERE event_id = :id;";
try {
$sth = $pdo->prepare($sql);
$sth->execute([":id" => $id]);
@@ -34,15 +34,15 @@ class EventModel extends Database {
public function updateEvent($id, $data) {
$pdo = $this->linkDB();
$sql = "UPDATE ausstellung SET standortid = :standortid, datum_von = :datum_von, datum_bis = :datum_bis, name = :name, beschreibung = :beschreibung, max_tickets = :max_tickets, preis = :preis WHERE ausstellungid = :id;";
$sql = "UPDATE event SET location_id = :location_id, start_date = :start_date, end_date = :end_date, name = :name, description = :description, max_tickets = :max_tickets, ticket_price = :ticket_price WHERE event_id = :id;";
$params = [
":standortid" => $data['standortid'],
":datum_von" => $data['datum_von'],
":datum_bis" => $data['datum_bis'],
":location_id" => $data['location_id'],
":start_date" => $data['start_date'],
":end_date" => $data['end_date'],
":name" => $data['name'],
":beschreibung" => $data['beschreibung'],
":description" => $data['description'],
":max_tickets" => $data['max_tickets'],
":preis" => $data['preis'],
":ticket_price" => $data['ticket_price'],
":id" => $id
];
try {
@@ -56,15 +56,15 @@ class EventModel extends Database {
public function createEvent($data) {
$pdo = $this->linkDB();
$sql = "INSERT INTO ausstellung (standortid, datum_von, datum_bis, name, beschreibung, max_tickets, preis) VALUES (:standortid, :datum_von, :datum_bis, :name, :beschreibung, :max_tickets, :preis);";
$sql = "INSERT INTO event (location_id, start_date, end_date, name, description, max_tickets, ticket_price) VALUES (:location_id, :start_date, :end_date, :name, :description, :max_tickets, :ticket_price);";
$params = [
":standortid" => $data['standortid'],
":datum_von" => $data['datum_von'],
":datum_bis" => $data['datum_bis'],
":location_id" => $data['location_id'],
":start_date" => $data['start_date'],
":end_date" => $data['end_date'],
":name" => $data['name'],
":beschreibung" => $data['beschreibung'],
":description" => $data['description'],
":max_tickets" => $data['max_tickets'],
":preis" => $data['preis']
":ticket_price" => $data['ticket_price']
];
try {
$sth = $pdo->prepare($sql);
@@ -78,7 +78,7 @@ class EventModel extends Database {
public function deleteEvent($id) {
$pdo = $this->linkDB();
$sql = "DELETE FROM ausstellung WHERE ausstellungid = :id;";
$sql = "DELETE FROM event WHERE event_id = :id;";
try {
$sth = $pdo->prepare($sql);
$sth->execute([":id" => $id]);

View File

@@ -8,7 +8,7 @@ class GutscheinModel extends Database {
public function getGutscheine() {
$pdo = $this->linkDB();
$sql = "SELECT * FROM gutschein ORDER BY gültigkeit DESC;";
$sql = "SELECT * FROM voucher ORDER BY valid_until DESC;";
try {
$sth = $pdo->prepare($sql);
$sth->execute();
@@ -21,7 +21,7 @@ class GutscheinModel extends Database {
public function getGutschein($id) {
$pdo = $this->linkDB();
$sql = "SELECT * FROM gutschein WHERE gutscheinid = :id;";
$sql = "SELECT * FROM voucher WHERE voucher_id = :id;";
$params = [":id" => $id];
try {
$sth = $pdo->prepare($sql);
@@ -35,12 +35,12 @@ class GutscheinModel extends Database {
public function createGutschein($data) {
$pdo = $this->linkDB();
$sql = "INSERT INTO gutschein (code, rabatt, eventid, gültigkeit) VALUES (:code, :rabatt, :eventid, :gültigkeit);";
$sql = "INSERT INTO voucher (code, discount, event_id, valid_until) VALUES (:code, :discount, :event_id, :valid_until);";
$params = [
":code" => $data['code'],
":rabatt" => $data['rabatt'],
":eventid" => $data['eventid'],
":gültigkeit" => $data['gültigkeit']
":discount" => $data['discount'],
":event_id" => $data['event_id'],
":valid_until" => $data['valid_until']
];
try {
$sth = $pdo->prepare($sql);
@@ -54,12 +54,12 @@ class GutscheinModel extends Database {
public function updateGutschein($id, $data) {
$pdo = $this->linkDB();
$sql = "UPDATE gutschein SET code = :code, rabatt = :rabatt, eventid = :eventid, gültigkeit = :gültigkeit WHERE gutscheinid = :id;";
$sql = "UPDATE voucher SET code = :code, discount = :discount, event_id = :event_id, valid_until = :valid_until WHERE voucher_id = :id;";
$params = [
":code" => $data['code'],
":rabatt" => $data['rabatt'],
":eventid" => $data['eventid'],
":gültigkeit" => $data['gültigkeit'],
":discount" => $data['discount'],
":event_id" => $data['event_id'],
":valid_until" => $data['valid_until'],
":id" => $id
];
try {
@@ -73,7 +73,7 @@ class GutscheinModel extends Database {
public function deleteGutschein($id) {
$pdo = $this->linkDB();
$sql = "DELETE FROM gutschein WHERE gutscheinid = :id;";
$sql = "DELETE FROM voucher WHERE voucher_id = :id;";
$params = [":id" => $id];
try {
$sth = $pdo->prepare($sql);

View File

@@ -8,8 +8,8 @@ class NewsModel extends Database {
public function getNewsById($newsId) {
$pdo = $this->linkDB();
$sql = "SELECT * FROM news WHERE newsid = :newsid;";
$params = [":newsid" => $newsId];
$sql = "SELECT * FROM news WHERE news_id = :news_id;";
$params = [":news_id" => $newsId];
try {
$sth = $pdo->prepare($sql);
$sth->execute($params);
@@ -22,12 +22,12 @@ class NewsModel extends Database {
public function updateNews($newsId, $news) {
$pdo = $this->linkDB();
$sql = "UPDATE news SET name = :name, beschreibung = :beschreibung, datum = :datum WHERE newsid = :newsid;";
$sql = "UPDATE news SET name = :name, description = :description, date = :date WHERE news_id = :news_id;";
$params = [
":name" => $news['titel'],
":beschreibung" => $news['inhalt'],
":datum" => $news['datum'],
":newsid" => $newsId
":description" => $news['inhalt'],
":date" => $news['datum'],
":news_id" => $newsId
];
try {
$sth = $pdo->prepare($sql);
@@ -41,7 +41,7 @@ class NewsModel extends Database {
public function getNews() {
$pdo = $this->linkDB();
$sql = "SELECT * FROM news ORDER BY datum DESC;";
$sql = "SELECT * FROM news ORDER BY date DESC;";
try {
$sth = $pdo->prepare($sql);
$sth->execute();
@@ -54,11 +54,11 @@ class NewsModel extends Database {
public function createNews($news) {
$pdo = $this->linkDB();
$sql = "INSERT INTO news (name, beschreibung, datum) VALUES (:name, :beschreibung, :datum);";
$sql = "INSERT INTO news (name, description, date) VALUES (:name, :description, :date);";
$params = [
":name" => $news['titel'],
":beschreibung" => $news['inhalt'],
":datum" => $news['datum']
":name" => $news['name'],
":description" => $news['description'],
":date" => $news['date']
];
try {
$sth = $pdo->prepare($sql);
@@ -72,8 +72,8 @@ class NewsModel extends Database {
public function deleteNews($newsId) {
$pdo = $this->linkDB();
$sql = "DELETE FROM news WHERE newsid = :newsid;";
$params = [":newsid" => $newsId];
$sql = "DELETE FROM news WHERE news_id = :news_id;";
$params = [":news_id" => $newsId];
try {
$sth = $pdo->prepare($sql);
$sth->execute($params);

View File

@@ -8,7 +8,7 @@ class StandortModel extends Database {
public function getStandorte() {
$pdo = $this->linkDB();
$sql = "SELECT * FROM Standort ORDER BY standortid ASC;";
$sql = "SELECT * FROM location ORDER BY location_id ASC;";
try {
$sth = $pdo->prepare($sql);
$sth->execute();
@@ -19,10 +19,10 @@ class StandortModel extends Database {
}
}
public function getStandort($standortid) {
public function getStandort($location_id) {
$pdo = $this->linkDB();
$sql = "SELECT * FROM Standort WHERE standortid = :standortid;";
$params = [":standortid" => $standortid];
$sql = "SELECT * FROM location WHERE location_id = :location_id;";
$params = [":location_id" => $location_id];
try {
$sth = $pdo->prepare($sql);
$sth->execute($params);
@@ -35,15 +35,15 @@ class StandortModel extends Database {
public function createStandort($data) {
$pdo = $this->linkDB();
$sql = "INSERT INTO Standort (straße, hausnr, postleitzahl, ort, land, tel, email)
VALUES (:straße, :hausnr, :postleitzahl, :ort, :land, :tel, :email);";
$sql = "INSERT INTO location (street, house_number, postal_code, city, country, phone, email)
VALUES (:street, :house_number, :postal_code, :city, :country, :phone, :email);";
$params = [
":straße" => $data['straße'],
":hausnr" => $data['hausnr'],
":postleitzahl" => $data['postleitzahl'],
":ort" => $data['ort'],
":land" => $data['land'],
":tel" => $data['tel'],
":street" => $data['street'],
":house_number" => $data['house_number'],
":postal_code" => $data['postal_code'],
":city" => $data['city'],
":country" => $data['country'],
":phone" => $data['phone'],
":email" => $data['email']
];
try {
@@ -56,26 +56,26 @@ class StandortModel extends Database {
}
}
public function updateStandort($standortid, $data) {
public function updateStandort($location_id, $data) {
$pdo = $this->linkDB();
$sql = "UPDATE Standort SET
straße = :straße,
hausnr = :hausnr,
postleitzahl = :postleitzahl,
ort = :ort,
land = :land,
tel = :tel,
$sql = "UPDATE location SET
street = :street,
house_number = :house_number,
postal_code = :postal_code,
city = :city,
country = :country,
phone = :phone,
email = :email
WHERE standortid = :standortid;";
WHERE location_id = :location_id;";
$params = [
":straße" => $data['straße'],
":hausnr" => $data['hausnr'],
":postleitzahl" => $data['postleitzahl'],
":ort" => $data['ort'],
":land" => $data['land'],
":tel" => $data['tel'],
":street" => $data['street'],
":house_number" => $data['house_number'],
":postal_code" => $data['postal_code'],
":city" => $data['city'],
":country" => $data['country'],
":phone" => $data['phone'],
":email" => $data['email'],
":standortid" => $standortid
":location_id" => $location_id
];
try {
$sth = $pdo->prepare($sql);
@@ -87,10 +87,10 @@ class StandortModel extends Database {
}
}
public function deleteStandort($standortid) {
public function deleteStandort($location_id) {
$pdo = $this->linkDB();
$sql = "DELETE FROM Standort WHERE standortid = :standortid;";
$params = [":standortid" => $standortid];
$sql = "DELETE FROM location WHERE location_id = :location_id;";
$params = [":location_id" => $location_id];
try {
$sth = $pdo->prepare($sql);
$sth->execute($params);

View File

@@ -8,7 +8,7 @@ class TicketModel extends Database {
public function getTickets() {
$pdo = $this->linkDB();
$sql = "SELECT * FROM Ticket ORDER BY ticketid ASC;";
$sql = "SELECT * FROM ticket ORDER BY ticket_id ASC;";
try {
$sth = $pdo->prepare($sql);
$sth->execute();
@@ -21,13 +21,13 @@ class TicketModel extends Database {
public function buyTicket($data) {
$pdo = $this->linkDB();
$sql = "INSERT INTO Ticket (userid, eventid, kaufdatum, gültigkeitsdatum)
VALUES (:userid, :eventid, :kaufdatum, :gültigkeitsdatum);";
$sql = "INSERT INTO ticket (user_id, event_id, purchase_date, valid_until)
VALUES (:user_id, :event_id, :purchase_date, :valid_until);";
$params = [
":userid" => $data['userid'],
":eventid" => $data['eventid'],
":kaufdatum" => $data['kaufdatum'],
":gültigkeitsdatum" => $data['gültigkeitsdatum']
":user_id" => $data['user_id'],
":event_id" => $data['event_id'],
":purchase_date" => $data['purchase_date'],
":valid_until" => $data['valid_until']
];
try {
$sth = $pdo->prepare($sql);
@@ -39,12 +39,12 @@ class TicketModel extends Database {
}
}
public function hasTicket($userid, $eventid) {
public function hasTicket($user_id, $event_id) {
$pdo = $this->linkDB();
$sql = "SELECT COUNT(*) as count FROM Ticket WHERE userid = :userid AND eventid = :eventid;";
$sql = "SELECT COUNT(*) as count FROM ticket WHERE user_id = :user_id AND event_id = :event_id;";
$params = [
":userid" => $userid,
":eventid" => $eventid
":user_id" => $user_id,
":event_id" => $event_id
];
try {
$sth = $pdo->prepare($sql);
@@ -56,10 +56,10 @@ class TicketModel extends Database {
}
}
public function deleteTicket($ticketid) {
public function deleteTicket($ticket_id) {
$pdo = $this->linkDB();
$sql = "DELETE FROM Ticket WHERE ticketid = :ticketid;";
$params = [":ticketid" => $ticketid];
$sql = "DELETE FROM ticket WHERE ticket_id = :ticket_id;";
$params = [":ticket_id" => $ticket_id];
try {
$sth = $pdo->prepare($sql);
$sth->execute($params);

View File

@@ -0,0 +1,23 @@
<div class="inhalt">
<div class="login-container">
<h1>Anmelden</h1>
<?php if (!empty($errors['login'])): ?>
<div class="login-error"><?=htmlspecialchars($errors['login'])?></div>
<?php endif; ?>
<form class="form-horizontal" action="index.php" method="post">
<input type="hidden" name="controller" value="Auth">
<input type="hidden" name="do" value="login">
<label for="email">E-Mail</label>
<input class="input-email" type="email" name="email" id="email" placeholder="E-Mail" required>
<label for="password">Passwort</label>
<input class="input-passwort" type="password" name="password" id="password" placeholder="Passwort" required>
<button class="button-loggin" type="submit">Login</button>
</form>
<div style="text-align:center; margin-top: 1.5em;">
<a class="link-passwort-vergessen" href="?controller=Auth&do=showForgotPasswordForm">Passwort vergessen?</a>
<br>
<a class="link-konto-erstellen" href="?controller=Auth&do=showRegistrationForm">Konto erstellen</a>
</div>
</div>
</div>

View File

@@ -1,20 +1,23 @@
<div class="inhalt">
<div class="login-container">
<div class="form-container">
<h1>Anmelden</h1>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-email" type="text" placeholder="E-Mail">
</label>
<?php if (!empty($errors['login'])): ?>
<div class="form-error"><?=htmlspecialchars($errors['login'])?></div>
<?php endif; ?>
<form class="form-horizontal" action="index.php" method="post">
<input type="hidden" name="controller" value="Auth">
<input type="hidden" name="do" value="login">
<label for="email">E-Mail</label>
<input class="input-email" type="email" name="email" id="email" placeholder="E-Mail" required>
<label for="password">Passwort</label>
<input class="input-passwort" type="password" name="password" id="password" placeholder="Passwort" required>
<button class="button-login" type="submit">Login</button>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-passwort" type="text" placeholder="Passwort">
</label>
</form>
<button class="button-loggin">Login</button>
<a class="link-passwort-vergessen" href="?controller=Login&do=showPasswortVergessen">Passwort vergessen?</a>
<a class="link-konto-erstellen" href="?controller=Register&do=showRegisterPage">Konto erstellen</a>
<div style="text-align:center; margin-top: 1.5em;">
<a class="link-passwort-vergessen" href="?controller=Auth&do=showForgotPasswordForm">Passwort vergessen?</a>
<br>
<a class="link-konto-erstellen" href="?controller=Auth&do=showRegistrationForm">Konto erstellen</a>
</div>
</div>
</div>

View File

@@ -0,0 +1,15 @@
<div class="inhalt">
<div class="login-success">
<h2>Login erfolgreich!</h2>
<p>Sie werden in wenigen Sekunden zu den News weitergeleitet...</p>
</div>
</div>
<script>
setTimeout(function() {
window.location.href = "?controller=News&do=showNews";
}, 2000); // 2 Sekunden warten
</script>
<noscript>
<meta http-equiv="refresh" content="2;url=?controller=News&do=showNews">
</noscript>

View File

@@ -0,0 +1,14 @@
<div class="inhalt">
<div class="login-success">
<h2>Logout erfolgreich!</h2>
<p>Sie werden in wenigen Sekunden zum Login weitergeleitet...</p>
</div>
</div>
<script>
setTimeout(function() {
window.location.href = "?controller=Auth&do=showLoginForm";
}, 2000); // 2 Sekunden warten
</script>
<noscript>
<meta http-equiv="refresh" content="2;url=?controller=Auth&do=showLoginForm">
</noscript>

View File

@@ -0,0 +1,37 @@
<div class="inhalt">
<div class="form-container">
<h1>Registrieren</h1>
<?php if (!empty($errors['register'])): ?>
<div class="form-error"><?=htmlspecialchars($errors['register'])?></div>
<?php endif; ?>
<form class="form-horizontal" action="index.php" method="post">
<input type="hidden" name="controller" value="Auth">
<input type="hidden" name="do" value="register">
<label for="first_name">Vorname</label>
<input class="input-vorname" type="text" name="first_name" id="first_name" placeholder="Vorname" required value="<?=htmlspecialchars($validData['first_name'] ?? '')?>">
<label for="last_name">Nachname</label>
<input class="input-nachname" type="text" name="last_name" id="last_name" placeholder="Nachname" required value="<?=htmlspecialchars($validData['last_name'] ?? '')?>">
<label for="email">E-Mail</label>
<input class="input-email" type="email" name="email" id="email" placeholder="E-Mail" required value="<?=htmlspecialchars($validData['email'] ?? '')?>">
<label for="password">Passwort</label>
<input class="input-passwort" type="password" name="password" id="password" placeholder="Passwort" required>
<label for="password_repeat">Passwort wiederholen</label>
<input class="input-passwort-repeat" type="password" name="password_repeat" id="password_repeat" placeholder="Passwort wiederholen" required>
<label for="street">Straße</label>
<input class="input-strasse" type="text" name="street" id="street" placeholder="Straße" required value="<?=htmlspecialchars($validData['street'] ?? '')?>">
<label for="house_number">Hausnr.</label>
<input class="input-hausnr" type="text" name="house_number" id="house_number" placeholder="Hausnr." required value="<?=htmlspecialchars($validData['house_number'] ?? '')?>">
<label for="postal_code">Postleitzahl</label>
<input class="input-postleitzahl" type="text" name="postal_code" id="postal_code" placeholder="Postleitzahl" required value="<?=htmlspecialchars($validData['postal_code'] ?? '')?>">
<label for="city">Ort</label>
<input class="input-ort" type="text" name="city" id="city" placeholder="Ort" required value="<?=htmlspecialchars($validData['city'] ?? '')?>">
<label for="country">Land</label>
<input class="input-land" type="text" name="country" id="country" placeholder="Land" required value="<?=htmlspecialchars($validData['country'] ?? '')?>">
<label for="phone">Telefonnr.</label>
<input class="input-tel" type="text" name="phone" id="phone" placeholder="Telefonnr." required value="<?=htmlspecialchars($validData['phone'] ?? '')?>">
<button class="button-register" type="submit">Registrieren</button>
</form>
<a class="link-konto-erstellen" href="?controller=Auth&do=showLoginForm">Login</a>
</div>
</div>

View File

@@ -0,0 +1,14 @@
<div class="inhalt">
<div class="login-success">
<h2>Registrierung erfolgreich!</h2>
<p>Sie werden in wenigen Sekunden zum Login weitergeleitet...</p>
</div>
</div>
<script>
setTimeout(function() {
window.location.href = "?controller=Auth&do=showLoginForm";
}, 2000);
</script>
<noscript>
<meta http-equiv="refresh" content="2;url=?controller=Auth&do=showLoginForm">
</noscript>

View File

@@ -1,12 +0,0 @@
<?php
include dirname(__DIR__).'/header.phtml';
?>
<div class="msg">
<p>Das Event "<?php echo $name?>" wurde erfolgreich erstellt!</p>
<a href="?controller=Event&do=showEvents">Weiter</a>
</div>
<?php include dirname(__DIR__).'/footer.phtml'; ?>

View File

@@ -2,11 +2,11 @@
include dirname(__DIR__).'/header.phtml';
?>
<div class="inhalt">
<div class="msg">
<p>Das Event mit der id"<?php echo $id?>" wurde erfolgreich gelöscht!</p>
<a href="?controller=Event&do=showEvents">Weiter</a>
</div>
</div>
<?php include dirname(__DIR__).'/footer.phtml'; ?>

View File

@@ -0,0 +1,36 @@
<div class="inhalt">
<h2>Create Event</h2>
<form action="/Event/create" method="POST">
<label>Event Name:</label>
<input type="text" name="name" required><br>
<label>Start Date:</label>
<input type="date" name="start_date" required><br>
<label>End Date:</label>
<input type="date" name="end_date" required><br>
<label>Location:</label>
<select name="location_id" required>
<option value="">Select location</option>
<?php if (!empty($locations)): ?>
<?php foreach ($locations as $loc): ?>
<option value="<?= htmlspecialchars($loc['location_id']) ?>">
<?= htmlspecialchars($loc['city']) ?>, <?= htmlspecialchars($loc['street']) ?> <?= htmlspecialchars($loc['house_number']) ?>
</option>
<?php endforeach; ?>
<?php endif; ?>
</select><br>
<label>Description:</label>
<textarea name="description" required></textarea><br>
<label>Max Tickets:</label>
<input type="number" name="max_tickets" required><br>
<label>Ticket Price:</label>
<input type="number" step="0.01" name="ticket_price" required><br>
<button type="submit">Create Event</button>
</form>
</div>

View File

@@ -0,0 +1,15 @@
<div class="inhalt">
<div class="create-forwarding">
<h2>Erstellen...</h2>
<p>Sie werden in wenigen Sekunden zu der Erstell Seite weitergeleitet...</p>
</div>
</div>
<script>
setTimeout(function() {
window.location.href = "?controller=Event&do=showCreateEvent";
}, 2000); // 2 Sekunden warten
</script>
<noscript>
<meta http-equiv="refresh" content="2;url=?controller=Event&do=showCreateEvent">
</noscript>

View File

@@ -1,8 +1,8 @@
<?php include dirname(__DIR__) . '/header.phtml'; ?>
<h2>Alle Ausstellungen</h2>
<?php if (!empty($events)): ?>
<div class="inhalt">
<div class="event-container">
<h2>Alle Ausstellungen</h2>
<div class="event-container-inhalt">
<table>
<thead>
<tr>
@@ -17,9 +17,9 @@
<?php foreach ($events as $event): ?>
<tr>
<td><?php echo htmlspecialchars($event['name']); ?></td>
<td><?php echo nl2br(htmlspecialchars($event['beschreibung'])); ?></td>
<td><?php echo date('d.m.Y', strtotime($event['datum_von'])); ?></td>
<td><?php echo date('d.m.Y', strtotime($event['datum_bis'])); ?></td>
<td><?php echo nl2br(htmlspecialchars($event['description'])); ?></td>
<td><?php echo date('d.m.Y', strtotime($event['start_date'])); ?></td>
<td><?php echo date('d.m.Y', strtotime($event['end_date'])); ?></td>
<td><?php echo (int) $event['max_tickets']; ?></td>
</tr>
<?php endforeach; ?>
@@ -28,5 +28,6 @@
<?php else: ?>
<p>Derzeit sind keine Ausstellungen verfügbar.</p>
<?php endif; ?>
<?php include dirname(__DIR__) . '/footer.phtml'; ?>
</div>
</div>
</div>

View File

@@ -0,0 +1,34 @@
<?php
include dirname(__DIR__).'/header.phtml';
?>
<div class="inhalt">
<h2>Update Event</h2>
<form action="/Event/update?id=<?= htmlspecialchars($event['id']) ?>" method="POST">
<label>Event Name:</label>
<input type="text" name="name" value="<?= htmlspecialchars($event['name']) ?>" required><br>
<label>Start Date:</label>
<input type="date" name="start_date" value="<?= htmlspecialchars($event['start_date']) ?>" required><br>
<label>End Date:</label>
<input type="date" name="end_date" value="<?= htmlspecialchars($event['end_date']) ?>" required><br>
<label>Location:</label>
<input type="text" name="location_name" value="<?= htmlspecialchars($event['location_name']) ?>" readonly><br>
<input type="hidden" name="location_id" value="<?= htmlspecialchars($event['location_id']) ?>">
<label>Description:</label>
<textarea name="description" required><?= htmlspecialchars($event['description']) ?></textarea><br>
<label>Max Tickets:</label>
<input type="number" name="max_tickets" value="<?= htmlspecialchars($event['max_tickets']) ?>" required><br>
<label>Ticket Price:</label>
<input type="number" step="0.01" name="ticket_price" value="<?= htmlspecialchars($event['ticket_price']) ?>" required><br>
<button type="submit">Update Event</button>
</form>
</div>
<?php include dirname(__DIR__).'/footer.phtml'; ?>

View File

@@ -0,0 +1,15 @@
<div class="inhalt">
<div class="update-forwarding">
<h2>Editieren...</h2>
<p>Sie werden in wenigen Sekunden zur Edit Seite weitergeleitet...</p>
</div>
</div>
<script>
setTimeout(function() {
window.location.href = "?controller=Event&do=showUpdateEvent";
}, 2000); // 2 Sekunden warten
</script>
<noscript>
<meta http-equiv="refresh" content="2;url=?controller=Event&do=showUpdateEvent">
</noscript>

View File

@@ -1,12 +0,0 @@
<?php
include dirname(__DIR__).'/header.phtml';
?>
<div class="msg">
<p>Das Event mit der ID "<?php echo $ausstellungid?>" wurde erfolgreich bearbeitet!</p>
<a href="?controller=Event&do=showEvents">Weiter</a>
</div>
<?php include dirname(__DIR__).'/footer.phtml'; ?>

View File

@@ -1,5 +1,6 @@
<?php include dirname(__DIR__) . '/header.phtml'; ?>
<div class="inhalt">
<h2>Alle Gutscheine</h2>
<a href="?controller=Gutschein&do=createGutscheinForm">Neuen Gutschein anlegen</a>
<?php if (!empty($gutscheine)): ?>
@@ -17,9 +18,9 @@
<?php foreach ($gutscheine as $g): ?>
<tr>
<td><?php echo htmlspecialchars($g['code']); ?></td>
<td><?php echo (int)$g['rabatt']; ?></td>
<td><?php echo (int)$g['eventid']; ?></td>
<td><?php echo htmlspecialchars($g['gültigkeit']); ?></td>
<td><?php echo (int)$g['discount']; ?></td>
<td><?php echo (int)$g['event_id']; ?></td>
<td><?php echo htmlspecialchars($g['valid_until']); ?></td>
<td>
<a href="?controller=Gutschein&action=editGutscheinForm&id=<?php echo $g['gutscheinid']; ?>">Bearbeiten</a> |
<a href="?controller=Gutschein&action=deleteGutschein&id=<?php echo $g['gutscheinid']; ?>" onclick="return confirm('Wirklich löschen?');">Löschen</a>
@@ -31,5 +32,5 @@
<?php else: ?>
<p>Keine Gutscheine vorhanden.</p>
<?php endif; ?>
</div>
<?php include dirname(__DIR__) . '/footer.phtml'; ?>

View File

@@ -0,0 +1,20 @@
<div class="inhalt">
<div class="form-container">
<h1>News erstellen</h1>
<?php if (!empty($errors['news'])): ?>
<div class="form-error"><?=htmlspecialchars($errors['news'])?></div>
<?php endif; ?>
<form class="form-horizontal" action="index.php" method="post">
<input type="hidden" name="controller" value="News">
<input type="hidden" name="do" value="createNews">
<label for="name">Titel</label>
<input type="text" name="name" id="name" required value="<?=htmlspecialchars($validData['name'] ?? '')?>">
<label for="date">Datum</label>
<input type="date" name="date" id="date" required value="<?=htmlspecialchars($validData['date'] ?? date('Y-m-d'))?>">
<label for="description">Beschreibung</label>
<textarea name="description" id="description" rows="7" required><?=htmlspecialchars($validData['description'] ?? '')?></textarea>
<button class="button-register" type="submit">News speichern</button>
</form>
<a href="?controller=News&do=showNews">Zurück zur Übersicht</a>
</div>
</div>

View File

@@ -0,0 +1,14 @@
<div class="inhalt">
<div class="login-success">
<h2>News erfolgreich erstellt!</h2>
<p>Du wirst in wenigen Sekunden zur Übersicht weitergeleitet...</p>
</div>
</div>
<script>
setTimeout(function() {
window.location.href = "?controller=News&do=showNews";
}, 2000);
</script>
<noscript>
<meta http-equiv="refresh" content="2;url=?controller=News&do=showNews">
</noscript>

View File

@@ -0,0 +1,14 @@
<div class="inhalt">
<div class="login-success">
<h2>News erfolgreich gelöscht!</h2>
<p>Du wirst in wenigen Sekunden zur Übersicht weitergeleitet...</p>
</div>
</div>
<script>
setTimeout(function() {
window.location.href = "?controller=News&do=showNews";
}, 2000);
</script>
<noscript>
<meta http-equiv="refresh" content="2;url=?controller=News&do=showNews">
</noscript>

View File

@@ -1,28 +1,28 @@
<?php include dirname(__DIR__) . '/header.phtml'; ?>
<h2>Alle News</h2>
<?php if (!empty($news)): ?>
<table>
<thead>
<tr>
<th>Name</th>
<th>Beschreibung</th>
<th>Datum</th>
</tr>
</thead>
<tbody>
<div class="inhalt">
<div class="event-container">
<h2>Alle News</h2>
<?php if (isset($_SESSION['is_admin']) && $_SESSION['is_admin']): ?>
<a href="?controller=News&do=createNewsForm" class="admin-btn">News erstellen</a>
<?php endif; ?>
<div class="news-cards">
<?php foreach ($news as $item): ?>
<tr>
<td><?php echo htmlspecialchars($item['name']); ?></td>
<td><?php echo nl2br(htmlspecialchars($item['beschreibung'])); ?></td>
<td><?php echo date('d.m.Y', strtotime($item['datum'])); ?></td>
</tr>
<div class="news-card">
<h3><?=htmlspecialchars($item['name'])?></h3>
<div class="news-date"><?=date('d.m.Y', strtotime($item['date']))?></div>
<div class="news-desc"><?=nl2br(htmlspecialchars($item['description']))?></div>
<?php if (isset($_SESSION['is_admin']) && $_SESSION['is_admin']): ?>
<div>
<a href="?controller=News&do=editNewsForm&id=<?=$item['news_id']?>" class="admin-btn">Bearbeiten</a>
<a href="?controller=News&do=deleteNews&id=<?=$item['news_id']?>" class="admin-btn" onclick="return confirm('Wirklich löschen?');">Löschen</a>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<p>Derzeit sind keine News verfügbar.</p>
<?php endif; ?>
<?php include dirname(__DIR__) . '/footer.phtml'; ?>
</div>
</div>
</div>

View File

@@ -1,64 +0,0 @@
<div class="inhalt">
<div class="login-container">
<h1>Registrieren</h1>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-vorname" type="text" placeholder="Vorname">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-nachname" type="text" placeholder="Nachname">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-email" type="text" placeholder="E-Mail">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-passwort" type="text" placeholder="Passwort">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-passwort-repeat" type="text" placeholder="Passwort wiederholen">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-strasse" type="text" placeholder="Straße">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-hausnr" type="text" placeholder="Hausnr.">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-postleitzahl" type="text" placeholder="Postleitzahl">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-ort" type="text" placeholder="Ort">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-land" type="text" placeholder="Land">
</label>
</form>
<form class="form-horizontal" action="#" method="post">
<label>
<input class="input-tel" type="text" placeholder="Telefonnr.">
</label>
</form>
<button class="button-register">Registrieren</button>
<a class="link-konto-erstellen" href="?controller=Login&do=showLoginPage">Login</a>
</div>
</div>

View File

@@ -1,5 +1,6 @@
<?php include dirname(__DIR__) . '/header.phtml'; ?>
<div class="inhalt">
<h2>Unsere Standorte</h2>
<?php if (!empty($standorte)): ?>
@@ -18,12 +19,12 @@
<tbody>
<?php foreach ($standorte as $standort): ?>
<tr>
<td><?php echo htmlspecialchars($standort['straße']); ?></td>
<td><?php echo htmlspecialchars($standort['hausnr']); ?></td>
<td><?php echo htmlspecialchars($standort['postleitzahl']); ?></td>
<td><?php echo htmlspecialchars($standort['ort']); ?></td>
<td><?php echo htmlspecialchars($standort['land']); ?></td>
<td><?php echo htmlspecialchars($standort['tel']); ?></td>
<td><?php echo htmlspecialchars($standort['street']); ?></td>
<td><?php echo htmlspecialchars($standort['house_number']); ?></td>
<td><?php echo htmlspecialchars($standort['postal_code']); ?></td>
<td><?php echo htmlspecialchars($standort['city']); ?></td>
<td><?php echo htmlspecialchars($standort['country']); ?></td>
<td><?php echo htmlspecialchars($standort['phone']); ?></td>
<td><?php echo htmlspecialchars($standort['email']); ?></td>
</tr>
<?php endforeach; ?>
@@ -32,5 +33,5 @@
<?php else: ?>
<p>Keine Standorte gefunden.</p>
<?php endif; ?>
</div>
<?php include dirname(__DIR__) . '/footer.phtml'; ?>

View File

@@ -12,11 +12,15 @@
<div id="logo" ><a class="link-logo" href="#"></a></div>
<button id="nav-toggle-btn" aria-label="Menü ein-/ausklappen">&#9660;</button>
<div class="nav-links">
<a id="link-tickets" class="links" href="?controller=Tickets&do=showTickets">Tickets</a>
<a id="link-infos" class="links" href="?controller=Welcome&do=showWelcome">Infos</a>
<a id="link-profil" class="links" href="?controller=Profile&do=showProfile">Profil</a>
<a id="link-login" class="links" href="?controller=Login&do=showLoginPage">Login</a>
<a id="link-register" class="links" href="?controller=Register&do=showRegisterPage">Register</a>
<?php if (isset($_SESSION['user'])): ?>
<a id="link-tickets" class="links" href="?controller=Event&do=showEvents">Event</a>
<a id="link-infos" class="links" href="?controller=News&do=showNews">Infos</a>
<a id="link-profil" class="links" href="?controller=Profile&do=showProfile">Profil</a>
<a id="link-logout" class="links" href="?controller=Auth&do=logout">Logout</a>
<?php else: ?>
<a id="link-login" class="links" href="?controller=Auth&do=showLoginForm">Login</a>
<a id="link-register" class="links" href="?controller=Auth&do=showRegistrationForm">Register</a>
<?php endif; ?>
<div id="profile-picture"></div>
</div>
</div>

View File

@@ -1,124 +1,112 @@
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Erstellungszeit: 24. Nov 2017 um 17:01
-- Server-Version: 10.1.16-MariaDB
-- PHP-Version: 7.0.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Datenbank: `blog`
--
-- --------------------------------------------------------
CREATE TABLE User (
userid INT AUTO_INCREMENT PRIMARY KEY,
vorname VARCHAR(50),
nachname VARCHAR(50),
strasse VARCHAR(100),
hausnr VARCHAR(10),
postleitzahl VARCHAR(10),
ort VARCHAR(50),
land VARCHAR(50),
tel VARCHAR(20),
CREATE TABLE user (
user_id INT AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
street VARCHAR(100),
house_number VARCHAR(10),
postal_code VARCHAR(10),
city VARCHAR(50),
country VARCHAR(50),
phone VARCHAR(20),
email VARCHAR(100) UNIQUE,
isAdmin BOOLEAN DEFAULT FALSE,
is_admin BOOLEAN DEFAULT FALSE,
valid_until DATETIME NOT NULL DEFAULT '3025-01-01 00:00:00',
password VARCHAR(255)
);
CREATE TABLE Standort (
standortid INT AUTO_INCREMENT PRIMARY KEY,
strasse VARCHAR(100),
hausnr VARCHAR(10),
plz VARCHAR(10),
ort VARCHAR(50),
land VARCHAR(50),
tel VARCHAR(20),
CREATE TABLE location (
location_id INT AUTO_INCREMENT PRIMARY KEY,
street VARCHAR(100),
house_number VARCHAR(10),
postal_code VARCHAR(10),
city VARCHAR(50),
country VARCHAR(50),
phone VARCHAR(20),
email VARCHAR(100)
);
CREATE TABLE Ausstellung (
austellungid INT AUTO_INCREMENT PRIMARY KEY,
standortid INT,
datum_von DATE,
datum_bis DATE,
CREATE TABLE event (
event_id INT AUTO_INCREMENT PRIMARY KEY,
location_id INT,
start_date DATE,
end_date DATE,
name VARCHAR(100),
beschreibung TEXT,
description TEXT,
max_tickets INT,
FOREIGN KEY (standortid) REFERENCES Standort(standortid)
ticket_price DECIMAL(5,2),
FOREIGN KEY (location_id) REFERENCES location(location_id)
);
CREATE TABLE Ticket (
ticketid INT AUTO_INCREMENT PRIMARY KEY,
userid INT,
ausstellungid INT,
kaufdatum DATE,
gueltigkeit DATE,
preis DECIMAL(10,2),
FOREIGN KEY (userid) REFERENCES User(userid),
FOREIGN KEY (ausstellungid) REFERENCES Ausstellung(austellungid)
CREATE TABLE ticket (
ticket_id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT,
event_id INT,
purchase_date DATE,
valid_until DATE,
FOREIGN KEY (user_id) REFERENCES user(user_id),
FOREIGN KEY (event_id) REFERENCES event(event_id)
);
CREATE TABLE Gutschein (
gutscheinid INT AUTO_INCREMENT PRIMARY KEY,
CREATE TABLE voucher (
voucher_id INT AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(50) UNIQUE,
rabatt INT CHECK (rabatt BETWEEN 0 AND 100),
ausstellungid INT,
gueltigkeit DATE,
FOREIGN KEY (ausstellungid) REFERENCES Ausstellung(austellungid)
discount INT CHECK (discount BETWEEN 0 AND 100),
event_id INT,
valid_until DATE,
FOREIGN KEY (event_id) REFERENCES event(event_id)
);
CREATE TABLE News (
newsid INT AUTO_INCREMENT PRIMARY KEY,
CREATE TABLE news (
news_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
beschreibung TEXT,
datum DATE
description TEXT,
date DATE
);
-- User-Daten
INSERT INTO User (vorname, nachname, strasse, hausnr, postleitzahl, ort, land, tel, email, isAdmin, password)
-- User-Daten (Passwort: passwort123)
INSERT INTO user (first_name, last_name, street, house_number, postal_code, city, country, phone, email, is_admin, password)
VALUES
('Max', 'Muster', 'Musterstraße', '1', '12345', 'Musterstadt', 'Deutschland', '0123456789', 'max@muster.de', FALSE, 'passwort123'),
('Anna', 'Beispiel', 'Beispielweg', '5a', '54321', 'Beispielstadt', 'Deutschland', '0987654321', 'anna@beispiel.de', TRUE, 'adminpass');
('Max', 'Muster', 'Musterstraße', '1', '12345', 'Musterstadt', 'Deutschland', '0123456789', 'max@muster.de', FALSE, '$2y$10$VAj.C0XHPUxV4oXS6b79aumlg5fBMPPx5FPqgkQSIQeBLh0WtYmKy'),
('Anna', 'Beispiel', 'Beispielweg', '5a', '54321', 'Beispielstadt', 'Deutschland', '0987654321', 'anna@beispiel.de', TRUE, '$2y$10$cnPBpkvLbdpDxzYvxlQg9uVp5y8ggr2SWL8NAMg9zk.3QnnEl.MGq');
-- Standort-Daten
INSERT INTO Standort (strasse, hausnr, plz, ort, land, tel, email)
INSERT INTO location (street, house_number, postal_code, city, country, phone, email)
VALUES
('Galeriestraße', '10', '10115', 'Berlin', 'Deutschland', '030123456', 'kontakt@galerie-berlin.de'),
('Kunstallee', '22b', '50667', 'Köln', 'Deutschland', '0221123456', 'info@kunst-koeln.de');
-- Ausstellung-Daten
INSERT INTO Ausstellung (standortid, datum_von, datum_bis, name, beschreibung, max_tickets)
INSERT INTO event (location_id, start_date, end_date, name, description, max_tickets, ticket_price)
VALUES
(1, '2025-07-01', '2025-08-31', 'Moderne Meisterwerke', 'Eine Sammlung moderner Kunstwerke aus Europa.', 200),
(2, '2025-09-10', '2025-10-20', 'Kunst der Antike', 'Ausstellung antiker Skulpturen und Gemälde.', 150);
(1, '2025-07-01', '2025-08-31', 'Moderne Meisterwerke', 'Eine Sammlung moderner Kunstwerke aus Europa.', 200, 19.99),
(2, '2025-09-10', '2025-10-20', 'Kunst der Antike', 'Ausstellung antiker Skulpturen und Gemälde.', 150, 39.99);
-- Gutschein-Daten (Spaltennamen korrigiert)
INSERT INTO Gutschein (code, rabatt, ausstellungid, gueltigkeit)
-- Gutschein-Daten
INSERT INTO voucher (code, discount, event_id, valid_until)
VALUES
('SOMMER2025', 15, 1, '2025-08-31'),
('HERBST25', 25, 2, '2025-10-15');
-- Ticket-Daten (Spaltennamen korrigiert)
INSERT INTO Ticket (userid, ausstellungid, kaufdatum, gueltigkeit, preis)
-- Ticket-Daten
INSERT INTO ticket (user_id, event_id, purchase_date, valid_until)
VALUES
(1, 1, '2025-06-01', '2025-07-15', 12.50),
(2, 2, '2025-06-05', '2025-09-15', 10.00);
(1, 1, '2025-06-01', '2025-07-15'),
(2, 2, '2025-06-05', '2025-09-15');
-- News-Daten
INSERT INTO News (name, beschreibung, datum)
INSERT INTO news (name, description, date)
VALUES
('Neuer Standort eröffnet', 'Unsere Galerie in Köln ist jetzt geöffnet!', '2025-06-01'),
('Frühbucher-Rabatt', 'Sichern Sie sich jetzt 15% Rabatt auf unsere Sommerausstellung.', '2025-05-20');
('Frühbucher-Rabatt', 'Sichern Sie sich jetzt 15% Rabatt auf unsere Sommerausstellung.', '2025-05-20');

View File

@@ -2,48 +2,46 @@
session_start();
include 'Views/header.phtml';
?>
<div id="wrapper">
<?php
spl_autoload_register(function ($className) {
if (substr($className, 0, 5) !== 'Blog\\') {
// not our business
return;
}
$fileName = __DIR__.'/'.str_replace('\\', DIRECTORY_SEPARATOR, substr($className, 5)).'.php';
if (file_exists($fileName)) {
include $fileName;
}
});
$controllerName = "";
$doMethodName = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$controllerName = isset($_POST['controller']) && $_POST['controller'] ? $_POST['controller'] : "Welcome";
$doMethodName = isset($_POST['do']) && $_POST['do'] ? $_POST['do'] : "showWelcome";
} else {
$controllerName = isset($_GET['controller']) && $_GET['controller'] ? $_GET['controller'] : "Welcome";
$doMethodName = isset($_GET['do']) && $_GET['do'] ? $_GET['do'] : "showWelcome";
<?php
spl_autoload_register(function ($className) {
if (substr($className, 0, 5) !== 'Blog\\') {
// not our business
return;
}
$controllerClassName = 'Blog\\Controller\\'.ucfirst($controllerName).'Controller';
$fileName = __DIR__.'/'.str_replace('\\', DIRECTORY_SEPARATOR, substr($className, 5)).'.php';
if (method_exists($controllerClassName, $doMethodName)) {
$view = new \Blog\Library\View(__DIR__.DIRECTORY_SEPARATOR.'Views'
, ucfirst($controllerName), $doMethodName);
$controller = new $controllerClassName($view);
$controller->$doMethodName();
$view->render();
} else {
new \Blog\Library\ErrorMsg('Page not found: '.$controllerClassName.'::'.$doMethodName);
if (file_exists($fileName)) {
include $fileName;
}
?>
</div>
});
$controllerName = "";
$doMethodName = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$controllerName = isset($_POST['controller']) && $_POST['controller'] ? $_POST['controller'] : "Welcome";
$doMethodName = isset($_POST['do']) && $_POST['do'] ? $_POST['do'] : "showWelcome";
} else {
$controllerName = isset($_GET['controller']) && $_GET['controller'] ? $_GET['controller'] : "Welcome";
$doMethodName = isset($_GET['do']) && $_GET['do'] ? $_GET['do'] : "showWelcome";
}
$controllerClassName = 'Blog\\Controller\\'.ucfirst($controllerName).'Controller';
if (method_exists($controllerClassName, $doMethodName)) {
$view = new \Blog\Library\View(__DIR__.DIRECTORY_SEPARATOR.'Views'
, ucfirst($controllerName), $doMethodName);
$controller = new $controllerClassName($view);
$controller->$doMethodName();
$view->render();
} else {
new \Blog\Library\ErrorMsg('Page not found: '.$controllerClassName.'::'.$doMethodName);
}
?>
<?php
include 'Views/footer.phtml';
?>