Compare commits
21 Commits
backend
...
9ce7a6cfd3
Author | SHA1 | Date | |
---|---|---|---|
9ce7a6cfd3 | |||
ca757d1723 | |||
717d361dbb | |||
404e846418 | |||
3ce61ace17 | |||
3dc68dd0bc | |||
b9fc6bcdd5 | |||
a50b48592b | |||
1691370db6 | |||
a6b672ee7e | |||
97c03d817e | |||
877be4e567 | |||
ef3349c6e4 | |||
415d8120e5 | |||
a4eef4e4e3 | |||
37ee931954 | |||
c6358b5ea6 | |||
cc4bc791c9 | |||
586322a189 | |||
1416fd7fa0 | |||
16a91cc028 |
6
.idea/sqldialects.xml
generated
6
.idea/sqldialects.xml
generated
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="SqlDialectMappings">
|
|
||||||
<file url="file://$PROJECT_DIR$/contact.sql" dialect="GenericSQL" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
291
CSS/style.css
291
CSS/style.css
@@ -4,9 +4,22 @@ body {
|
|||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
width: 100vw;
|
||||||
|
max-width: 100vw;
|
||||||
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
#wrapper {
|
#wrapper {
|
||||||
|
flex: 1 0 auto;
|
||||||
|
min-height: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-start;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
width: 100vw;
|
||||||
|
max-width: 100vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
@@ -16,6 +29,11 @@ a {
|
|||||||
#navigation {
|
#navigation {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 1000;
|
||||||
|
background: #BAC8D4;
|
||||||
|
width: 100vw;
|
||||||
}
|
}
|
||||||
.link-container {
|
.link-container {
|
||||||
display: grid;
|
display: grid;
|
||||||
@@ -38,17 +56,19 @@ a {
|
|||||||
background-size: contain;
|
background-size: contain;
|
||||||
}
|
}
|
||||||
#footer {
|
#footer {
|
||||||
position: absolute;
|
position: relative;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100vw;
|
||||||
height: 240px;
|
height: 180px;
|
||||||
background-color: #BAC8D4;
|
background-color: #BAC8D4;
|
||||||
|
display: flex;
|
||||||
display: grid;
|
flex-direction: column;
|
||||||
grid-template-columns: 6% 5% 43% 32% 14%;
|
|
||||||
grid-template-rows: 45% 10% 45%;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
z-index: 999;
|
||||||
|
padding: 10px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container-zahlungsmittel {
|
.container-zahlungsmittel {
|
||||||
@@ -61,11 +81,16 @@ a {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.inhalt {
|
.inhalt {
|
||||||
|
flex: 1 1 auto;
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 10px;
|
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 100%;
|
width: 100vw;
|
||||||
|
min-height: 0;
|
||||||
|
min-width: 0;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 2vw;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zahlungsmittel-img {
|
.zahlungsmittel-img {
|
||||||
@@ -102,27 +127,26 @@ a {
|
|||||||
padding-right: 30px;
|
padding-right: 30px;
|
||||||
}
|
}
|
||||||
.container-welcome-inhalt {
|
.container-welcome-inhalt {
|
||||||
grid-template-columns: 39% 61%;
|
|
||||||
display: grid;
|
display: grid;
|
||||||
width: 110em;
|
grid-template-columns: 1fr 1fr;
|
||||||
min-height: 80%;
|
width: 100%;
|
||||||
|
max-width: 900px;
|
||||||
|
min-height: 200px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
|
background: white;
|
||||||
|
box-shadow: 0 2px 16px rgba(0,0,0,0.08);
|
||||||
|
justify-items: center;
|
||||||
|
align-items: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 10px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.beispiel-austellung1-img {
|
.beispiel-austellung1-img, .beispiel-austellung2-img {
|
||||||
height: 480px;
|
height: 200px;
|
||||||
width: 670px;
|
width: 90vw;
|
||||||
background-image: url("../images/beispiel-austellung1.png");
|
max-width: 320px;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
justify-self: right;
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
.beispiel-austellung2-img {
|
|
||||||
background-image: url("../images/beispiel-austellung2.png");
|
|
||||||
background-position: center;
|
|
||||||
background-size: contain;
|
|
||||||
justify-self: right;
|
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,4 +157,221 @@ a {
|
|||||||
width: 900px;
|
width: 900px;
|
||||||
height: 450px;
|
height: 450px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-container {
|
||||||
|
position: absolute;
|
||||||
|
top: 200px;
|
||||||
|
background-color: #BAC8D4;
|
||||||
|
width: 900px;
|
||||||
|
height: 450px;
|
||||||
|
border-radius: 10px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
body {
|
||||||
|
font-size: 14px;
|
||||||
|
width: 100vw;
|
||||||
|
max-width: 100vw;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
#wrapper {
|
||||||
|
width: 100vw;
|
||||||
|
max-width: 100vw;
|
||||||
|
}
|
||||||
|
#navigation {
|
||||||
|
width: 100vw;
|
||||||
|
min-width: 0;
|
||||||
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.link-container {
|
||||||
|
width: 100vw;
|
||||||
|
min-width: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
row-gap: 8px;
|
||||||
|
border-radius: 0;
|
||||||
|
padding: 0 4px;
|
||||||
|
}
|
||||||
|
.links {
|
||||||
|
font-size: 18px;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 6px 0;
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
#logo {
|
||||||
|
width: 120px;
|
||||||
|
height: 40px;
|
||||||
|
margin: 0 auto 8px auto;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.container-welcome-inhalt {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
width: 100vw;
|
||||||
|
max-width: 100vw;
|
||||||
|
min-height: 0;
|
||||||
|
padding: 8px 0;
|
||||||
|
}
|
||||||
|
.beispiel-austellung1-img, .beispiel-austellung2-img {
|
||||||
|
width: 90vw;
|
||||||
|
max-width: 98vw;
|
||||||
|
height: 120px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.inhalt {
|
||||||
|
width: 100vw;
|
||||||
|
min-width: 0;
|
||||||
|
max-width: 100vw;
|
||||||
|
padding: 0 2vw;
|
||||||
|
box-sizing: border-box;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
#footer {
|
||||||
|
width: 100vw;
|
||||||
|
height: auto;
|
||||||
|
min-height: 120px;
|
||||||
|
padding: 10px 0 10px 0;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
.container-zahlungsmittel {
|
||||||
|
width: 100vw;
|
||||||
|
text-align: center;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.header-zahlungsarten {
|
||||||
|
font-size: 1.1em;
|
||||||
|
padding-right: 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.zahlungsmittel-img {
|
||||||
|
width: 90vw;
|
||||||
|
max-width: 200px;
|
||||||
|
height: 30px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
.line {
|
||||||
|
width: 95vw;
|
||||||
|
}
|
||||||
|
.link-impressum, .link-datenschutz, .link-nutzungsbedingungen {
|
||||||
|
display: block;
|
||||||
|
padding: 2px 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.text-bib {
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.desktop-only {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
.mobile-only {
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
.login-container {
|
||||||
|
position: static;
|
||||||
|
width: 95vw;
|
||||||
|
max-width: 400px;
|
||||||
|
height: auto;
|
||||||
|
margin: 24px auto;
|
||||||
|
padding: 16px 8px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.event-container {
|
||||||
|
position: static;
|
||||||
|
width: 95vw;
|
||||||
|
max-width: 400px;
|
||||||
|
height: auto;
|
||||||
|
margin: 24px auto;
|
||||||
|
padding: 16px 8px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.login-container h1 {
|
||||||
|
font-size: 1.5em;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.event-container h1 {
|
||||||
|
font-size: 1.5em;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.login-container form,
|
||||||
|
.login-container label,
|
||||||
|
.login-container input {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.login-container button,
|
||||||
|
.login-container a {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
margin-top: 8px;
|
||||||
|
text-align: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
#nav-toggle-btn {
|
||||||
|
display: block;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
font-size: 2em;
|
||||||
|
cursor: pointer;
|
||||||
|
margin: 0 auto 8px auto;
|
||||||
|
transition: transform 0.2s;
|
||||||
|
}
|
||||||
|
.nav-links {
|
||||||
|
display: none;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
transition: max-height 0.3s ease;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.nav-links.open {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
#nav-toggle-btn.open {
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 601px) {
|
||||||
|
.mobile-only {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
.desktop-only {
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
#nav-toggle-btn {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.nav-links {
|
||||||
|
display: flex !important;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
width: auto;
|
||||||
|
gap: 32px;
|
||||||
|
}
|
||||||
|
.nav-links .links {
|
||||||
|
margin: 0 12px;
|
||||||
|
}
|
||||||
}
|
}
|
148
Controller/AuthController.php
Normal file
148
Controller/AuthController.php
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Blog\Controller;
|
||||||
|
|
||||||
|
use Blog\Model\AuthModel;
|
||||||
|
|
||||||
|
class AuthController
|
||||||
|
{
|
||||||
|
private $model;
|
||||||
|
private $view;
|
||||||
|
|
||||||
|
public function __construct($view) {
|
||||||
|
$this->model = new AuthModel();
|
||||||
|
$this->view = $view;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showLoginForm() {
|
||||||
|
$this->view->setVars([
|
||||||
|
'labels' => [
|
||||||
|
"email" => "E-Mail-Adresse",
|
||||||
|
"password" => "Passwort",
|
||||||
|
"password_repeat" => "Passwort wiederholen",
|
||||||
|
"old_password" => "Altes Passwort"
|
||||||
|
],
|
||||||
|
'errors' => $_SESSION['auth_errors'] ?? [],
|
||||||
|
'validData' => $_SESSION['auth_validData'] ?? []
|
||||||
|
]);
|
||||||
|
unset($_SESSION['auth_errors'], $_SESSION['auth_validData']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showRegistrationForm() {
|
||||||
|
$this->view->setVars([
|
||||||
|
'labels' => [
|
||||||
|
"email" => "E-Mail-Adresse",
|
||||||
|
"password" => "Passwort",
|
||||||
|
"password_repeat" => "Passwort wiederholen",
|
||||||
|
"old_password" => "Altes Passwort"
|
||||||
|
],
|
||||||
|
'errors' => $_SESSION['auth_errors'] ?? [],
|
||||||
|
'validData' => $_SESSION['auth_validData'] ?? []
|
||||||
|
]);
|
||||||
|
unset($_SESSION['auth_errors'], $_SESSION['auth_validData']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function login() {
|
||||||
|
$email = $_POST['email'];
|
||||||
|
$password = $_POST['password'];
|
||||||
|
|
||||||
|
$result = $this->model->login($email, $password);
|
||||||
|
|
||||||
|
if ($result === true) {
|
||||||
|
$_SESSION['user'] = $email;
|
||||||
|
$this->view->setDoMethodName('showLoginSuccess');
|
||||||
|
} else {
|
||||||
|
$this->view->setVars([
|
||||||
|
'errors' => ['login' => is_string($result) ? $result : "Login fehlgeschlagen."],
|
||||||
|
'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'] ?? '',
|
||||||
|
'email' => $_POST['email'] ?? '',
|
||||||
|
'password' => $_POST['password'] ?? '',
|
||||||
|
'password_repeat' => $_POST['password_repeat'] ?? '',
|
||||||
|
'is_admin' => $_POST['isAdmin'] ?? false,
|
||||||
|
];
|
||||||
|
|
||||||
|
$result = $this->model->register($data);
|
||||||
|
|
||||||
|
if ($result === true) {
|
||||||
|
$this->view->setVars(['success' => 'Registrierung erfolgreich!']);
|
||||||
|
$this->view->render('Auth/showLoginForm');
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$errors['register'] = is_string($result) ? $result : "Registrierung fehlgeschlagen.";
|
||||||
|
$this->view->setVars(['errors' => $errors, 'validData' => $data]);
|
||||||
|
$this->view->render('Auth/showRegistrationForm');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function forgotPassword() {
|
||||||
|
$email = $_POST['email'] ?? '';
|
||||||
|
if (empty($email)) {
|
||||||
|
$_SESSION['auth_errors']['email'] = "Bitte E-Mail-Adresse angeben.";
|
||||||
|
header("Location: /?controller=Auth&do=showAuthForm");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$this->model->pwForgot($email);
|
||||||
|
header("Location: /?controller=Auth&do=showConfirmation&msg=pwforgot");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function changePassword()
|
||||||
|
{
|
||||||
|
$email = $_POST['email'] ?? '';
|
||||||
|
$oldpw = $_POST['old_password'] ?? '';
|
||||||
|
$newpw = $_POST['password'] ?? '';
|
||||||
|
$repeat = $_POST['password_repeat'] ?? '';
|
||||||
|
|
||||||
|
if (!$this->model->checkDoublePw($newpw, $repeat)) {
|
||||||
|
$_SESSION['auth_errors']['password'] = "Neue Passwörter stimmen nicht überein.";
|
||||||
|
header("Location: /?controller=Auth&do=showAuthForm");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->model->updatePassword($email, $oldpw, $newpw);
|
||||||
|
|
||||||
|
if ($result === true) {
|
||||||
|
header("Location: /?controller=Auth&do=showConfirmation&msg=pwchange");
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$_SESSION['auth_errors']['password'] = is_string($result) ? $result : "Fehler beim Aktualisieren des Passworts.";
|
||||||
|
header("Location: /?controller=Auth&do=showAuthForm");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showConfirmation() {
|
||||||
|
$messages = [
|
||||||
|
'login' => "Login erfolgreich.",
|
||||||
|
'register' => "Registrierung erfolgreich.",
|
||||||
|
'pwforgot' => "Ein temporäres Passwort wurde an Ihre E-Mail gesendet.",
|
||||||
|
'pwchange' => "Passwort erfolgreich geändert."
|
||||||
|
];
|
||||||
|
$msgKey = $_GET['msg'] ?? '';
|
||||||
|
$message = $messages[$msgKey] ?? "Aktion erfolgreich.";
|
||||||
|
$this->view->setVars(['message' => $message]);
|
||||||
|
$this->view->render('auth/confirmation');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function logout() {
|
||||||
|
unset($_SESSION['user']);
|
||||||
|
session_destroy();
|
||||||
|
$this->view->setDoMethodName('showLogoutSuccess');
|
||||||
|
}
|
||||||
|
}
|
@@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
@@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace Blog\Controller;
|
|
||||||
|
|
||||||
class LoginController {
|
|
||||||
function showLoginPage()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
10
Controller/ProfileController.php
Normal file
10
Controller/ProfileController.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
namespace Blog\Controller;
|
||||||
|
|
||||||
|
class ProfileController {
|
||||||
|
function showProfile()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
10
Controller/TicketsController.php
Normal file
10
Controller/TicketsController.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
namespace Blog\Controller;
|
||||||
|
|
||||||
|
class TicketsController {
|
||||||
|
function showTickets()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
239
Model/AuthModel.php
Normal file
239
Model/AuthModel.php
Normal file
@@ -0,0 +1,239 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Blog\Model;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
|
use PDO;
|
||||||
|
use PDOException;
|
||||||
|
|
||||||
|
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";
|
||||||
|
$params = [":email" => $email];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$sth = $pdo->prepare($sql);
|
||||||
|
$sth->execute($params);
|
||||||
|
$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
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
return "Benutzer mit dieser E-Mail wurde nicht gefunden.";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!password_verify($password, $user['password'])) {
|
||||||
|
return "Das eingegebene Passwort ist falsch.";
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$now = new DateTime();
|
||||||
|
$validUntil = new DateTime($user['valid_until']);
|
||||||
|
|
||||||
|
if ($now > $validUntil) {
|
||||||
|
return "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 true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function register($data) {
|
||||||
|
if (!filter_var($data['email'], FILTER_VALIDATE_EMAIL)) {
|
||||||
|
return "Bitte geben Sie eine gültige E-Mail ein.";
|
||||||
|
}
|
||||||
|
|
||||||
|
$requiredFields = [
|
||||||
|
'email', 'password', 'street', 'house_number', 'city', 'postal_code',
|
||||||
|
'country', 'first_name', 'last_name', 'phone'
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($requiredFields as $field) {
|
||||||
|
if (empty($data[$field])) {
|
||||||
|
return "Bitte füllen Sie alle Felder aus.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->userExistsByEmail($data['email'])) {
|
||||||
|
return "Ein Account mit dieser E-Mail existiert bereits.";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Passwort-Validierung
|
||||||
|
if (!$this->checkDoublePw($data['password'], $data['password_repeat'])) {
|
||||||
|
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.";
|
||||||
|
}
|
||||||
|
|
||||||
|
$hashedPassword = password_hash($data['password'], PASSWORD_DEFAULT);
|
||||||
|
|
||||||
|
$sql = "INSERT INTO user (email, password, street, house_number, city, postal_code, country, first_name, last_name, phone, is_admin)
|
||||||
|
VALUES (:email, :password, :street, :house_number, :city, :postal_code, :country, :first_name, :last_name, :phone, :is_admin)";
|
||||||
|
|
||||||
|
$params = [
|
||||||
|
':email' => $data['email'],
|
||||||
|
':password' => $hashedPassword,
|
||||||
|
':street' => $data['street'],
|
||||||
|
':house_number' => $data['house_number'],
|
||||||
|
':city' => $data['city'],
|
||||||
|
':postal_code'=> $data['postal_code'],
|
||||||
|
':country'=> $data['country'],
|
||||||
|
':first_name' => $data['first_name'],
|
||||||
|
':last_name'=> $data['last_name'],
|
||||||
|
':phone' => $data['phone'],
|
||||||
|
':is_admin' => $data['is_admin'] ? 1 : 0,
|
||||||
|
];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = $this->linkDB();
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
$stmt->execute($params);
|
||||||
|
return true;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
new \Blog\Library\ErrorMsg("Fehler beim Schreiben der Daten.", $e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function userExistsByEmail($email) {
|
||||||
|
try {
|
||||||
|
$pdo = $this->linkDB();
|
||||||
|
|
||||||
|
$sql = "SELECT user_id FROM user WHERE email = :email";
|
||||||
|
$params = [':email' => $email];
|
||||||
|
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
$stmt->execute($params);
|
||||||
|
|
||||||
|
return (bool) $stmt->fetch();
|
||||||
|
} catch (\PDOException $e) {
|
||||||
|
new \Blog\Library\ErrorMsg("Fehler bei der E-Mail-Prüfung", $e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function pwForgot($email){
|
||||||
|
$randomPw = bin2hex(random_bytes(12 / 2));
|
||||||
|
$hashedPassword = password_hash($randomPw, PASSWORD_DEFAULT);
|
||||||
|
|
||||||
|
$this->forgottenPwUpdate($email, $hashedPassword);
|
||||||
|
|
||||||
|
$betreff = "Passwort zurücksetzen bei bibArts";
|
||||||
|
$nachricht = "Hallo,\n\nhier ihr temporäres Passwort:\n\n $randomPw \n\n Bitte beachten Sie, dass das Passwort nur 2 stunden Gülltig ist. \nViele Grüße,\nbibArts Team";
|
||||||
|
|
||||||
|
$header = "From: noreply@edu.bib.de\r\n";
|
||||||
|
$header .= "Content-Type: text/plain; charset=UTF-8\r\n";
|
||||||
|
|
||||||
|
$maxTries = 5;
|
||||||
|
$try = 0;
|
||||||
|
$success = false;
|
||||||
|
|
||||||
|
while ($try < $maxTries && !$success) {
|
||||||
|
$erfolg = mail($email, $betreff, $nachricht, $header);
|
||||||
|
$try++;
|
||||||
|
if (!$erfolg) {
|
||||||
|
error_log("Mailversuch $try an $email fehlgeschlagen.");
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function forgottenPwUpdate($email, $hashedPassword) {
|
||||||
|
try{
|
||||||
|
$pdo = $this->linkDB();
|
||||||
|
|
||||||
|
$sqlCheck = "SELECT COUNT(*) FROM user WHERE email = :email";
|
||||||
|
$stmt = $pdo->prepare($sqlCheck);
|
||||||
|
$stmt->execute([':email' => $email]);
|
||||||
|
if ($stmt->fetchColumn() == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$validUntil = (new DateTime())->add(new DateInterval('PT2H'))->format('Y-m-d H:i:s');
|
||||||
|
|
||||||
|
|
||||||
|
$sql = "UPDATE user
|
||||||
|
SET password = :password, valid_until = :valid_until
|
||||||
|
WHERE email = :email";
|
||||||
|
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
$params = [
|
||||||
|
':email' => $email,
|
||||||
|
':password' => $hashedPassword,
|
||||||
|
':valid_until' => $validUntil
|
||||||
|
];
|
||||||
|
return $stmt->execute($params);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
new \Blog\Library\ErrorMsg("Fehler beim Aktualisieren der Daten.", $e);
|
||||||
|
die;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updatePassword($email, $oldpw, $newpw){
|
||||||
|
if(!$this->login($email, $oldpw)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$requiredFields = [$email, $oldpw, $newpw];
|
||||||
|
foreach ($requiredFields as $field) {
|
||||||
|
if (empty($field)) {
|
||||||
|
return "Bitte füllen Sie alle Felder aus";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$hashedPassword = password_hash($newpw, PASSWORD_DEFAULT);
|
||||||
|
|
||||||
|
$sql = "UPDATE user SET password = :password WHERE email = :email";
|
||||||
|
|
||||||
|
try{
|
||||||
|
$pdo = $this->linkDB();
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
$params = [
|
||||||
|
':email' => $email,
|
||||||
|
':password' => $hashedPassword,
|
||||||
|
];
|
||||||
|
return $stmt->execute($params);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
new \Blog\Library\ErrorMsg("Fehler beim Schreiben der Daten.", $e);
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkDoublePw($password1, $password2){
|
||||||
|
if($password1 === $password2){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function pwRequirementCheck($password){
|
||||||
|
$error = [];
|
||||||
|
|
||||||
|
if(strlen($password) <= 8)
|
||||||
|
$error[] = "min 8 Charackter";
|
||||||
|
if(!preg_match("/[A-Z]/", $password))
|
||||||
|
$error[] = "min one large Character";
|
||||||
|
if(!preg_match("/[a-z]/", $password))
|
||||||
|
$error[] = "min one small charakter";
|
||||||
|
if(!preg_match("/[0-9]/", $password))
|
||||||
|
$error[] = "min one number";
|
||||||
|
if(!preg_match("[^a-zA-Z0-9\s]", $password));
|
||||||
|
$error[] = "min one special character";
|
||||||
|
|
||||||
|
if(empty($error))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return $error;
|
||||||
|
}
|
||||||
|
}
|
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -8,7 +8,7 @@ class EventModel extends Database {
|
|||||||
|
|
||||||
public function getEvents() {
|
public function getEvents() {
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
$sql = "SELECT * FROM ausstellung ORDER BY datum_von DESC;";
|
$sql = "SELECT * FROM event ORDER BY start_date DESC;";
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
@@ -21,7 +21,7 @@ class EventModel extends Database {
|
|||||||
|
|
||||||
public function getEvent($id) {
|
public function getEvent($id) {
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
$sql = "SELECT * FROM ausstellung WHERE ausstellungid = :id;";
|
$sql = "SELECT * FROM event WHERE event_id = :id;";
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
$sth->execute([":id" => $id]);
|
$sth->execute([":id" => $id]);
|
||||||
@@ -34,15 +34,15 @@ class EventModel extends Database {
|
|||||||
|
|
||||||
public function updateEvent($id, $data) {
|
public function updateEvent($id, $data) {
|
||||||
$pdo = $this->linkDB();
|
$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 = [
|
$params = [
|
||||||
":standortid" => $data['standortid'],
|
":location_id" => $data['location_id'],
|
||||||
":datum_von" => $data['datum_von'],
|
":start_date" => $data['start_date'],
|
||||||
":datum_bis" => $data['datum_bis'],
|
":end_date" => $data['end_date'],
|
||||||
":name" => $data['name'],
|
":name" => $data['name'],
|
||||||
":beschreibung" => $data['beschreibung'],
|
":description" => $data['description'],
|
||||||
":max_tickets" => $data['max_tickets'],
|
":max_tickets" => $data['max_tickets'],
|
||||||
":preis" => $data['preis'],
|
":ticket_price" => $data['ticket_price'],
|
||||||
":id" => $id
|
":id" => $id
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
@@ -56,15 +56,15 @@ class EventModel extends Database {
|
|||||||
|
|
||||||
public function createEvent($data) {
|
public function createEvent($data) {
|
||||||
$pdo = $this->linkDB();
|
$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 = [
|
$params = [
|
||||||
":standortid" => $data['standortid'],
|
":location_id" => $data['location_id'],
|
||||||
":datum_von" => $data['datum_von'],
|
":start_date" => $data['start_date'],
|
||||||
":datum_bis" => $data['datum_bis'],
|
":end_date" => $data['end_date'],
|
||||||
":name" => $data['name'],
|
":name" => $data['name'],
|
||||||
":beschreibung" => $data['beschreibung'],
|
":description" => $data['description'],
|
||||||
":max_tickets" => $data['max_tickets'],
|
":max_tickets" => $data['max_tickets'],
|
||||||
":preis" => $data['preis']
|
":ticket_price" => $data['ticket_price']
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
@@ -78,7 +78,7 @@ class EventModel extends Database {
|
|||||||
|
|
||||||
public function deleteEvent($id) {
|
public function deleteEvent($id) {
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
$sql = "DELETE FROM ausstellung WHERE ausstellungid = :id;";
|
$sql = "DELETE FROM event WHERE event_id = :id;";
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
$sth->execute([":id" => $id]);
|
$sth->execute([":id" => $id]);
|
||||||
|
@@ -8,7 +8,7 @@ class GutscheinModel extends Database {
|
|||||||
|
|
||||||
public function getGutscheine() {
|
public function getGutscheine() {
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
$sql = "SELECT * FROM gutschein ORDER BY gültigkeit DESC;";
|
$sql = "SELECT * FROM voucher ORDER BY valid_until DESC;";
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
@@ -21,7 +21,7 @@ class GutscheinModel extends Database {
|
|||||||
|
|
||||||
public function getGutschein($id) {
|
public function getGutschein($id) {
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
$sql = "SELECT * FROM gutschein WHERE gutscheinid = :id;";
|
$sql = "SELECT * FROM voucher WHERE voucher_id = :id;";
|
||||||
$params = [":id" => $id];
|
$params = [":id" => $id];
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
@@ -35,12 +35,12 @@ class GutscheinModel extends Database {
|
|||||||
|
|
||||||
public function createGutschein($data) {
|
public function createGutschein($data) {
|
||||||
$pdo = $this->linkDB();
|
$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 = [
|
$params = [
|
||||||
":code" => $data['code'],
|
":code" => $data['code'],
|
||||||
":rabatt" => $data['rabatt'],
|
":discount" => $data['discount'],
|
||||||
":eventid" => $data['eventid'],
|
":event_id" => $data['event_id'],
|
||||||
":gültigkeit" => $data['gültigkeit']
|
":valid_until" => $data['valid_until']
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
@@ -54,12 +54,12 @@ class GutscheinModel extends Database {
|
|||||||
|
|
||||||
public function updateGutschein($id, $data) {
|
public function updateGutschein($id, $data) {
|
||||||
$pdo = $this->linkDB();
|
$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 = [
|
$params = [
|
||||||
":code" => $data['code'],
|
":code" => $data['code'],
|
||||||
":rabatt" => $data['rabatt'],
|
":discount" => $data['discount'],
|
||||||
":eventid" => $data['eventid'],
|
":event_id" => $data['event_id'],
|
||||||
":gültigkeit" => $data['gültigkeit'],
|
":valid_until" => $data['valid_until'],
|
||||||
":id" => $id
|
":id" => $id
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
@@ -73,7 +73,7 @@ class GutscheinModel extends Database {
|
|||||||
|
|
||||||
public function deleteGutschein($id) {
|
public function deleteGutschein($id) {
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
$sql = "DELETE FROM gutschein WHERE gutscheinid = :id;";
|
$sql = "DELETE FROM voucher WHERE voucher_id = :id;";
|
||||||
$params = [":id" => $id];
|
$params = [":id" => $id];
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
|
@@ -8,8 +8,8 @@ class NewsModel extends Database {
|
|||||||
|
|
||||||
public function getNewsById($newsId) {
|
public function getNewsById($newsId) {
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
$sql = "SELECT * FROM news WHERE newsid = :newsid;";
|
$sql = "SELECT * FROM news WHERE news_id = :news_id;";
|
||||||
$params = [":newsid" => $newsId];
|
$params = [":news_id" => $newsId];
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
$sth->execute($params);
|
$sth->execute($params);
|
||||||
@@ -22,12 +22,12 @@ class NewsModel extends Database {
|
|||||||
|
|
||||||
public function updateNews($newsId, $news) {
|
public function updateNews($newsId, $news) {
|
||||||
$pdo = $this->linkDB();
|
$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 = [
|
$params = [
|
||||||
":name" => $news['titel'],
|
":name" => $news['titel'],
|
||||||
":beschreibung" => $news['inhalt'],
|
":description" => $news['inhalt'],
|
||||||
":datum" => $news['datum'],
|
":date" => $news['datum'],
|
||||||
":newsid" => $newsId
|
":news_id" => $newsId
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
@@ -41,7 +41,7 @@ class NewsModel extends Database {
|
|||||||
|
|
||||||
public function getNews() {
|
public function getNews() {
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
$sql = "SELECT * FROM news ORDER BY datum DESC;";
|
$sql = "SELECT * FROM news ORDER BY date DESC;";
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
@@ -54,11 +54,11 @@ class NewsModel extends Database {
|
|||||||
|
|
||||||
public function createNews($news) {
|
public function createNews($news) {
|
||||||
$pdo = $this->linkDB();
|
$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 = [
|
$params = [
|
||||||
":name" => $news['titel'],
|
":name" => $news['titel'],
|
||||||
":beschreibung" => $news['inhalt'],
|
":description" => $news['inhalt'],
|
||||||
":datum" => $news['datum']
|
":date" => $news['datum']
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
@@ -72,8 +72,8 @@ class NewsModel extends Database {
|
|||||||
|
|
||||||
public function deleteNews($newsId) {
|
public function deleteNews($newsId) {
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
$sql = "DELETE FROM news WHERE newsid = :newsid;";
|
$sql = "DELETE FROM news WHERE news_id = :news_id;";
|
||||||
$params = [":newsid" => $newsId];
|
$params = [":news_id" => $newsId];
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
$sth->execute($params);
|
$sth->execute($params);
|
||||||
|
@@ -8,7 +8,7 @@ class StandortModel extends Database {
|
|||||||
|
|
||||||
public function getStandorte() {
|
public function getStandorte() {
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
$sql = "SELECT * FROM Standort ORDER BY standortid ASC;";
|
$sql = "SELECT * FROM location ORDER BY location_id ASC;";
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
@@ -19,10 +19,10 @@ class StandortModel extends Database {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getStandort($standortid) {
|
public function getStandort($location_id) {
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
$sql = "SELECT * FROM Standort WHERE standortid = :standortid;";
|
$sql = "SELECT * FROM location WHERE location_id = :location_id;";
|
||||||
$params = [":standortid" => $standortid];
|
$params = [":location_id" => $location_id];
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
$sth->execute($params);
|
$sth->execute($params);
|
||||||
@@ -35,15 +35,15 @@ class StandortModel extends Database {
|
|||||||
|
|
||||||
public function createStandort($data) {
|
public function createStandort($data) {
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
$sql = "INSERT INTO Standort (straße, hausnr, postleitzahl, ort, land, tel, email)
|
$sql = "INSERT INTO location (street, house_number, postal_code, city, country, phone, email)
|
||||||
VALUES (:straße, :hausnr, :postleitzahl, :ort, :land, :tel, :email);";
|
VALUES (:street, :house_number, :postal_code, :city, :country, :phone, :email);";
|
||||||
$params = [
|
$params = [
|
||||||
":straße" => $data['straße'],
|
":street" => $data['street'],
|
||||||
":hausnr" => $data['hausnr'],
|
":house_number" => $data['house_number'],
|
||||||
":postleitzahl" => $data['postleitzahl'],
|
":postal_code" => $data['postal_code'],
|
||||||
":ort" => $data['ort'],
|
":city" => $data['city'],
|
||||||
":land" => $data['land'],
|
":country" => $data['country'],
|
||||||
":tel" => $data['tel'],
|
":phone" => $data['phone'],
|
||||||
":email" => $data['email']
|
":email" => $data['email']
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
@@ -56,26 +56,26 @@ class StandortModel extends Database {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateStandort($standortid, $data) {
|
public function updateStandort($location_id, $data) {
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
$sql = "UPDATE Standort SET
|
$sql = "UPDATE location SET
|
||||||
straße = :straße,
|
street = :street,
|
||||||
hausnr = :hausnr,
|
house_number = :house_number,
|
||||||
postleitzahl = :postleitzahl,
|
postal_code = :postal_code,
|
||||||
ort = :ort,
|
city = :city,
|
||||||
land = :land,
|
country = :country,
|
||||||
tel = :tel,
|
phone = :phone,
|
||||||
email = :email
|
email = :email
|
||||||
WHERE standortid = :standortid;";
|
WHERE location_id = :location_id;";
|
||||||
$params = [
|
$params = [
|
||||||
":straße" => $data['straße'],
|
":street" => $data['street'],
|
||||||
":hausnr" => $data['hausnr'],
|
":house_number" => $data['house_number'],
|
||||||
":postleitzahl" => $data['postleitzahl'],
|
":postal_code" => $data['postal_code'],
|
||||||
":ort" => $data['ort'],
|
":city" => $data['city'],
|
||||||
":land" => $data['land'],
|
":country" => $data['country'],
|
||||||
":tel" => $data['tel'],
|
":phone" => $data['phone'],
|
||||||
":email" => $data['email'],
|
":email" => $data['email'],
|
||||||
":standortid" => $standortid
|
":location_id" => $location_id
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
@@ -87,10 +87,10 @@ class StandortModel extends Database {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteStandort($standortid) {
|
public function deleteStandort($location_id) {
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
$sql = "DELETE FROM Standort WHERE standortid = :standortid;";
|
$sql = "DELETE FROM location WHERE location_id = :location_id;";
|
||||||
$params = [":standortid" => $standortid];
|
$params = [":location_id" => $location_id];
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
$sth->execute($params);
|
$sth->execute($params);
|
||||||
|
@@ -8,7 +8,7 @@ class TicketModel extends Database {
|
|||||||
|
|
||||||
public function getTickets() {
|
public function getTickets() {
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
$sql = "SELECT * FROM Ticket ORDER BY ticketid ASC;";
|
$sql = "SELECT * FROM ticket ORDER BY ticket_id ASC;";
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
@@ -21,13 +21,13 @@ class TicketModel extends Database {
|
|||||||
|
|
||||||
public function buyTicket($data) {
|
public function buyTicket($data) {
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
$sql = "INSERT INTO Ticket (userid, eventid, kaufdatum, gültigkeitsdatum)
|
$sql = "INSERT INTO ticket (user_id, event_id, purchase_date, valid_until)
|
||||||
VALUES (:userid, :eventid, :kaufdatum, :gültigkeitsdatum);";
|
VALUES (:user_id, :event_id, :purchase_date, :valid_until);";
|
||||||
$params = [
|
$params = [
|
||||||
":userid" => $data['userid'],
|
":user_id" => $data['user_id'],
|
||||||
":eventid" => $data['eventid'],
|
":event_id" => $data['event_id'],
|
||||||
":kaufdatum" => $data['kaufdatum'],
|
":purchase_date" => $data['purchase_date'],
|
||||||
":gültigkeitsdatum" => $data['gültigkeitsdatum']
|
":valid_until" => $data['valid_until']
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$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();
|
$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 = [
|
$params = [
|
||||||
":userid" => $userid,
|
":user_id" => $user_id,
|
||||||
":eventid" => $eventid
|
":event_id" => $event_id
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
@@ -56,10 +56,10 @@ class TicketModel extends Database {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteTicket($ticketid) {
|
public function deleteTicket($ticket_id) {
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
$sql = "DELETE FROM Ticket WHERE ticketid = :ticketid;";
|
$sql = "DELETE FROM ticket WHERE ticket_id = :ticket_id;";
|
||||||
$params = [":ticketid" => $ticketid];
|
$params = [":ticket_id" => $ticket_id];
|
||||||
try {
|
try {
|
||||||
$sth = $pdo->prepare($sql);
|
$sth = $pdo->prepare($sql);
|
||||||
$sth->execute($params);
|
$sth->execute($params);
|
||||||
|
23
Views/Auth/forgotPassword.phtml
Normal file
23
Views/Auth/forgotPassword.phtml
Normal 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>
|
||||||
|
|
23
Views/Auth/showLoginForm.phtml
Normal file
23
Views/Auth/showLoginForm.phtml
Normal 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>
|
||||||
|
|
15
Views/Auth/showLoginSuccess.phtml
Normal file
15
Views/Auth/showLoginSuccess.phtml
Normal 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>
|
||||||
|
|
14
Views/Auth/showLogoutSuccess.phtml
Normal file
14
Views/Auth/showLogoutSuccess.phtml
Normal 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>
|
@@ -1,15 +1,3 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="HTML-5">
|
|
||||||
<head>
|
|
||||||
<title>VR Contact</title>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<link href="../../CSS/style.css" rel="stylesheet" type="text/css" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<?php
|
|
||||||
include dirname(__DIR__) . '/header.phtml';
|
|
||||||
?>
|
|
||||||
<div class="inhalt">
|
<div class="inhalt">
|
||||||
<div class="login-container">
|
<div class="login-container">
|
||||||
<h1>Registrieren</h1>
|
<h1>Registrieren</h1>
|
||||||
@@ -69,13 +57,8 @@ include dirname(__DIR__) . '/header.phtml';
|
|||||||
</label>
|
</label>
|
||||||
</form>
|
</form>
|
||||||
<button class="button-register">Registrieren</button>
|
<button class="button-register">Registrieren</button>
|
||||||
<a class="link-konto-erstellen">Login</a>
|
<a class="link-konto-erstellen" href="?controller=Auth&do=showLoginForm">Login</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
|
||||||
include dirname(__DIR__) . '/footer.phtml';
|
|
||||||
?>
|
|
||||||
<body>
|
|
||||||
</html>
|
|
||||||
|
|
@@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
include dirname(__DIR__).'/header.phtml';
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="msg">
|
|
||||||
<p>Ihre Anfrage wurde erfolgreich versendet.</p>
|
|
||||||
<a href="?controller=Welcome&do=showWelcome">Weiter</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
|
@@ -1,36 +0,0 @@
|
|||||||
<?php
|
|
||||||
include dirname(__DIR__).'/header.phtml';
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h2>Ihre Anfrage an uns</h2>
|
|
||||||
<form method="post">
|
|
||||||
|
|
||||||
<?php foreach ($labels as $index => $value) {
|
|
||||||
echo '<label for="' . $index . '">' . $value . '</label>';
|
|
||||||
if ($index == "content") {
|
|
||||||
echo "<textarea id=\"$index\" name=\"$index\" >";
|
|
||||||
if (isset($validData[$index])) { echo $validData[$index]; }
|
|
||||||
echo "</textarea><br>";
|
|
||||||
} else {
|
|
||||||
echo '<input type="text" name="' . $index . '" value="' . (isset($validData[$index]) ? $validData[$index] : '') . '"><br>';
|
|
||||||
}
|
|
||||||
if (isset($errors[$index])) {
|
|
||||||
echo '<label class="errorMsg">' . $errors[$index] . '</label><br>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<input type="hidden" name="controller" value="contact">
|
|
||||||
<input type="hidden" name="do" value="validateForm">
|
|
||||||
<input type="submit" name="submit" value="Absenden"></form>
|
|
||||||
|
|
||||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
|
@@ -2,11 +2,11 @@
|
|||||||
include dirname(__DIR__).'/header.phtml';
|
include dirname(__DIR__).'/header.phtml';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<div class="inhalt">
|
||||||
<div class="msg">
|
<div class="msg">
|
||||||
<p>Das Event "<?php echo $name?>" wurde erfolgreich erstellt!</p>
|
<p>Das Event "<?php echo $name?>" wurde erfolgreich erstellt!</p>
|
||||||
<a href="?controller=Event&do=showEvents">Weiter</a>
|
<a href="?controller=Event&do=showEvents">Weiter</a>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
@@ -2,11 +2,11 @@
|
|||||||
include dirname(__DIR__).'/header.phtml';
|
include dirname(__DIR__).'/header.phtml';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<div class="inhalt">
|
||||||
<div class="msg">
|
<div class="msg">
|
||||||
<p>Das Event mit der id"<?php echo $id?>" wurde erfolgreich gelöscht!</p>
|
<p>Das Event mit der id"<?php echo $id?>" wurde erfolgreich gelöscht!</p>
|
||||||
<a href="?controller=Event&do=showEvents">Weiter</a>
|
<a href="?controller=Event&do=showEvents">Weiter</a>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
@@ -1,8 +1,8 @@
|
|||||||
<?php include dirname(__DIR__) . '/header.phtml'; ?>
|
|
||||||
|
|
||||||
<h2>Alle Ausstellungen</h2>
|
|
||||||
|
|
||||||
<?php if (!empty($events)): ?>
|
<?php if (!empty($events)): ?>
|
||||||
|
<div class="inhalt">
|
||||||
|
<div class="event-container">
|
||||||
|
<h2>Alle Ausstellungen</h2>
|
||||||
|
<div class="event-container-inhalt">
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -17,9 +17,9 @@
|
|||||||
<?php foreach ($events as $event): ?>
|
<?php foreach ($events as $event): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo htmlspecialchars($event['name']); ?></td>
|
<td><?php echo htmlspecialchars($event['name']); ?></td>
|
||||||
<td><?php echo nl2br(htmlspecialchars($event['beschreibung'])); ?></td>
|
<td><?php echo nl2br(htmlspecialchars($event['description'])); ?></td>
|
||||||
<td><?php echo date('d.m.Y', strtotime($event['datum_von'])); ?></td>
|
<td><?php echo date('d.m.Y', strtotime($event['start_date'])); ?></td>
|
||||||
<td><?php echo date('d.m.Y', strtotime($event['datum_bis'])); ?></td>
|
<td><?php echo date('d.m.Y', strtotime($event['end_date'])); ?></td>
|
||||||
<td><?php echo (int) $event['max_tickets']; ?></td>
|
<td><?php echo (int) $event['max_tickets']; ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@@ -28,5 +28,6 @@
|
|||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<p>Derzeit sind keine Ausstellungen verfügbar.</p>
|
<p>Derzeit sind keine Ausstellungen verfügbar.</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
<?php include dirname(__DIR__) . '/footer.phtml'; ?>
|
</div>
|
||||||
|
</div>
|
@@ -2,11 +2,11 @@
|
|||||||
include dirname(__DIR__).'/header.phtml';
|
include dirname(__DIR__).'/header.phtml';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<div class="inhalt">
|
||||||
<div class="msg">
|
<div class="msg">
|
||||||
<p>Das Event mit der ID "<?php echo $ausstellungid?>" wurde erfolgreich bearbeitet!</p>
|
<p>Das Event mit der ID "<?php echo $ausstellungid?>" wurde erfolgreich bearbeitet!</p>
|
||||||
<a href="?controller=Event&do=showEvents">Weiter</a>
|
<a href="?controller=Event&do=showEvents">Weiter</a>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
@@ -1,5 +1,6 @@
|
|||||||
<?php include dirname(__DIR__) . '/header.phtml'; ?>
|
<?php include dirname(__DIR__) . '/header.phtml'; ?>
|
||||||
|
|
||||||
|
<div class="inhalt">
|
||||||
<h2>Alle Gutscheine</h2>
|
<h2>Alle Gutscheine</h2>
|
||||||
<a href="?controller=Gutschein&do=createGutscheinForm">Neuen Gutschein anlegen</a>
|
<a href="?controller=Gutschein&do=createGutscheinForm">Neuen Gutschein anlegen</a>
|
||||||
<?php if (!empty($gutscheine)): ?>
|
<?php if (!empty($gutscheine)): ?>
|
||||||
@@ -17,9 +18,9 @@
|
|||||||
<?php foreach ($gutscheine as $g): ?>
|
<?php foreach ($gutscheine as $g): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo htmlspecialchars($g['code']); ?></td>
|
<td><?php echo htmlspecialchars($g['code']); ?></td>
|
||||||
<td><?php echo (int)$g['rabatt']; ?></td>
|
<td><?php echo (int)$g['discount']; ?></td>
|
||||||
<td><?php echo (int)$g['eventid']; ?></td>
|
<td><?php echo (int)$g['event_id']; ?></td>
|
||||||
<td><?php echo htmlspecialchars($g['gültigkeit']); ?></td>
|
<td><?php echo htmlspecialchars($g['valid_until']); ?></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="?controller=Gutschein&action=editGutscheinForm&id=<?php echo $g['gutscheinid']; ?>">Bearbeiten</a> |
|
<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>
|
<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: ?>
|
<?php else: ?>
|
||||||
<p>Keine Gutscheine vorhanden.</p>
|
<p>Keine Gutscheine vorhanden.</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
<?php include dirname(__DIR__) . '/footer.phtml'; ?>
|
<?php include dirname(__DIR__) . '/footer.phtml'; ?>
|
@@ -1,37 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="HTML-5">
|
|
||||||
<head>
|
|
||||||
<title>VR Contact</title>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<link href="../../CSS/style.css" rel="stylesheet" type="text/css" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<?php
|
|
||||||
include dirname(__DIR__) . '/header.phtml';
|
|
||||||
?>
|
|
||||||
<div class="inhalt">
|
|
||||||
<div class="login-container">
|
|
||||||
<h1>Anmelden</h1>
|
|
||||||
<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>
|
|
||||||
<button class="button-loggin">Login</button>
|
|
||||||
<a class="link-passwort-vergessen">Passwort vergessen?</a>
|
|
||||||
<a class="link-konto-erstellen">Konto erstellen</a>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
include dirname(__DIR__) . '/footer.phtml';
|
|
||||||
?>
|
|
||||||
<body>
|
|
||||||
</html>
|
|
||||||
|
|
@@ -1,8 +1,8 @@
|
|||||||
<?php include dirname(__DIR__) . '/header.phtml'; ?>
|
|
||||||
|
|
||||||
<h2>Alle News</h2>
|
|
||||||
|
|
||||||
<?php if (!empty($news)): ?>
|
<?php if (!empty($news)): ?>
|
||||||
|
<div class="inhalt">
|
||||||
|
<div class="event-container">
|
||||||
|
<h2>Alle Infos</h2>
|
||||||
|
<div class="event-container-inhalt">
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -15,14 +15,17 @@
|
|||||||
<?php foreach ($news as $item): ?>
|
<?php foreach ($news as $item): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo htmlspecialchars($item['name']); ?></td>
|
<td><?php echo htmlspecialchars($item['name']); ?></td>
|
||||||
<td><?php echo nl2br(htmlspecialchars($item['beschreibung'])); ?></td>
|
<td><?php echo nl2br(htmlspecialchars($item['name'])); ?></td>
|
||||||
<td><?php echo date('d.m.Y', strtotime($item['datum'])); ?></td>
|
<td><?php echo nl2br(htmlspecialchars($item['description'])); ?></td>
|
||||||
|
<td><?php echo date('d.m.Y', strtotime($item['date'])); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<p>Derzeit sind keine News verfügbar.</p>
|
<p>Derzeit sind keine News verfügbar.</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
<?php include dirname(__DIR__) . '/footer.phtml'; ?>
|
</div>
|
||||||
|
</div>
|
0
Views/Profile/showProfile.phtml
Normal file
0
Views/Profile/showProfile.phtml
Normal file
@@ -1,5 +1,6 @@
|
|||||||
<?php include dirname(__DIR__) . '/header.phtml'; ?>
|
<?php include dirname(__DIR__) . '/header.phtml'; ?>
|
||||||
|
|
||||||
|
<div class="inhalt">
|
||||||
<h2>Unsere Standorte</h2>
|
<h2>Unsere Standorte</h2>
|
||||||
|
|
||||||
<?php if (!empty($standorte)): ?>
|
<?php if (!empty($standorte)): ?>
|
||||||
@@ -18,12 +19,12 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($standorte as $standort): ?>
|
<?php foreach ($standorte as $standort): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo htmlspecialchars($standort['straße']); ?></td>
|
<td><?php echo htmlspecialchars($standort['street']); ?></td>
|
||||||
<td><?php echo htmlspecialchars($standort['hausnr']); ?></td>
|
<td><?php echo htmlspecialchars($standort['house_number']); ?></td>
|
||||||
<td><?php echo htmlspecialchars($standort['postleitzahl']); ?></td>
|
<td><?php echo htmlspecialchars($standort['postal_code']); ?></td>
|
||||||
<td><?php echo htmlspecialchars($standort['ort']); ?></td>
|
<td><?php echo htmlspecialchars($standort['city']); ?></td>
|
||||||
<td><?php echo htmlspecialchars($standort['land']); ?></td>
|
<td><?php echo htmlspecialchars($standort['country']); ?></td>
|
||||||
<td><?php echo htmlspecialchars($standort['tel']); ?></td>
|
<td><?php echo htmlspecialchars($standort['phone']); ?></td>
|
||||||
<td><?php echo htmlspecialchars($standort['email']); ?></td>
|
<td><?php echo htmlspecialchars($standort['email']); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@@ -32,5 +33,5 @@
|
|||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<p>Keine Standorte gefunden.</p>
|
<p>Keine Standorte gefunden.</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
<?php include dirname(__DIR__) . '/footer.phtml'; ?>
|
<?php include dirname(__DIR__) . '/footer.phtml'; ?>
|
8
Views/Tickets/showTickets.phtml
Normal file
8
Views/Tickets/showTickets.phtml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<div class="inhalt">
|
||||||
|
<div class="tickets-container">
|
||||||
|
<h1>Tickets</h1>
|
||||||
|
<div class="tickets-container-inhalt">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
include dirname(__DIR__).'/header.phtml';
|
|
||||||
?>
|
|
||||||
|
|
||||||
<article>
|
|
||||||
<h2>Virtuelles Museum</h2>
|
|
||||||
<span class="articleInfo">John Doe | 12.08.2018 um 10:18 Uhr</span>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<img class="articleImg" src="images/museum.jpg" alt="my Oculus Rift">
|
|
||||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Curabitur pretium tincidunt lacus. Nulla gravida orci a odio.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Proin nonummy, lacus eget pulvinar lacinia, pede felis dignissim leo, vitae tristique magna lacus sit amet eros. Nullam ornare. Praesent odio ligula, dapibus sed, tincidunt eget, dictum ac, nibh. Nam quis lacus. Nunc eleifend molestie velit. Morbi lobortis quam eu velit. Donec euismod vestibulum massa. Donec non lectus. Aliquam commodo lacus sit amet nulla. Cras dignissim elit et augue. Nullam non diam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In hac habitasse platea dictumst. Aenean vestibulum. Sed lobortis elit quis lectus. Nunc sed lacus at augue bibendum dapibus.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Aliquam vehicula sem ut pede. Cras purus lectus, egestas eu, vehicula at, imperdiet sed, nibh. Morbi consectetuer luctus felis. Donec vitae nisi. Aliquam tincidunt feugiat elit. Duis sed elit ut turpis ullamcorper feugiat. Praesent pretium, mauris sed fermentum hendrerit, nulla lorem iaculis magna, pulvinar scelerisque urna tellus a justo. Suspendisse pulvinar massa in metus. Duis quis quam. Proin justo. Curabitur ac sapien. Nam erat.
|
|
||||||
Praesent ut quam.
|
|
||||||
</p>
|
|
||||||
</article>
|
|
||||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
|
@@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
include dirname(__DIR__).'/header.phtml';
|
|
||||||
?>
|
|
||||||
|
|
||||||
<article>
|
|
||||||
<h2>Implement Controller</h2>
|
|
||||||
<span class="articleInfo">John Doe | 18.07.2018 um 18:43 Uhr</span>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<img class="articleImg" src="images/controller.jpg" alt="my Oculus Rift">
|
|
||||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Curabitur pretium tincidunt lacus. Nulla gravida orci a odio.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Proin nonummy, lacus eget pulvinar lacinia, pede felis dignissim leo, vitae tristique magna lacus sit amet eros. Nullam ornare. Praesent odio ligula, dapibus sed, tincidunt eget, dictum ac, nibh. Nam quis lacus. Nunc eleifend molestie velit. Morbi lobortis quam eu velit. Donec euismod vestibulum massa. Donec non lectus. Aliquam commodo lacus sit amet nulla. Cras dignissim elit et augue. Nullam non diam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In hac habitasse platea dictumst. Aenean vestibulum. Sed lobortis elit quis lectus. Nunc sed lacus at augue bibendum dapibus.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Aliquam vehicula sem ut pede. Cras purus lectus, egestas eu, vehicula at, imperdiet sed, nibh. Morbi consectetuer luctus felis. Donec vitae nisi. Aliquam tincidunt feugiat elit. Duis sed elit ut turpis ullamcorper feugiat. Praesent pretium, mauris sed fermentum hendrerit, nulla lorem iaculis magna, pulvinar scelerisque urna tellus a justo. Suspendisse pulvinar massa in metus. Duis quis quam. Proin justo. Curabitur ac sapien. Nam erat.
|
|
||||||
Praesent ut quam.
|
|
||||||
</p>
|
|
||||||
</article>
|
|
||||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
|
@@ -1,16 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="HTML-5">
|
|
||||||
<?php
|
|
||||||
include dirname(__DIR__).'/header.phtml';
|
|
||||||
?>
|
|
||||||
<div class="inhalt">
|
|
||||||
<div class="container-welcome-inhalt">
|
|
||||||
<div class="beispiel-austellung1-img"></div>
|
|
||||||
<div class="beispiel-austellung2-img"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
include dirname(__DIR__).'/footer.phtml';
|
|
||||||
?>
|
|
||||||
</html>
|
|
||||||
|
|
@@ -1,19 +1,13 @@
|
|||||||
<head>
|
<div id="footer">
|
||||||
<title>VR Contact</title>
|
<div class="container-zahlungsmittel">
|
||||||
<meta charset="UTF-8" />
|
<h2 class="header-zahlungsarten">Mögliche Zahlungsarten</h2>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<div class="zahlungsmittel-img"></div>
|
||||||
<link href="CSS/style.css" rel="stylesheet" type="text/css" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="footer">
|
|
||||||
<div class="container-zahlungsmittel">
|
|
||||||
<h2 class="header-zahlungsarten">Mögliche Zahlungsarten</h2>
|
|
||||||
<div class="zahlungsmittel-img"></div>
|
|
||||||
</div>
|
|
||||||
<div class="line"></div>
|
|
||||||
<a class="link-impressum">Impressum</a>
|
|
||||||
<a class="link-datenschutz">Datenschutz</a>
|
|
||||||
<a class="link-nutzungsbedingungen">Nutzungsbedingungen</a>
|
|
||||||
<span class="text-bib">© bib arts GmbH</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="line"></div>
|
||||||
|
<a class="link-impressum">Impressum</a>
|
||||||
|
<a class="link-datenschutz">Datenschutz</a>
|
||||||
|
<a class="link-nutzungsbedingungen">Nutzungsbedingungen</a>
|
||||||
|
<span class="text-bib">© bib arts GmbH</span>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
</html>
|
@@ -7,15 +7,34 @@
|
|||||||
<link href="CSS/style.css" rel="stylesheet" type="text/css" />
|
<link href="CSS/style.css" rel="stylesheet" type="text/css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="wrapper">
|
<nav id="navigation">
|
||||||
<nav id="navigation">
|
<div class="link-container">
|
||||||
<div class="link-container">
|
<div id="logo" ><a class="link-logo" href="#"></a></div>
|
||||||
<div id="logo" ><a class="link-logo" href="#"></a></div>
|
<button id="nav-toggle-btn" aria-label="Menü ein-/ausklappen">▼</button>
|
||||||
<a id="link-tickets" class="links" href="#">Tickets</a>
|
<div class="nav-links">
|
||||||
<a id="link-infos" class="links" href="?controller=Welcome&do=showWelcome">Infos</a>
|
<a id="link-tickets" class="links" href="?controller=Event&do=showEvents">Event</a>
|
||||||
<a id="link-profil" class="links" href="?controller=Contact&do=showContactForm">Profil</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>
|
||||||
|
<?php if (isset($_SESSION['user'])): ?>
|
||||||
|
<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>
|
||||||
|
<?php endif; ?>
|
||||||
|
<a id="link-register" class="links" href="?controller=Auth&do=showRegistrationForm">Register</a>
|
||||||
<div id="profile-picture"></div>
|
<div id="profile-picture"></div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</div>
|
||||||
</body>
|
</nav>
|
||||||
</html>
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
var btn = document.getElementById('nav-toggle-btn');
|
||||||
|
var links = document.querySelector('.nav-links');
|
||||||
|
if (btn && links) {
|
||||||
|
btn.addEventListener('click', function() {
|
||||||
|
links.classList.toggle('open');
|
||||||
|
btn.classList.toggle('open');
|
||||||
|
btn.innerHTML = links.classList.contains('open') ? '▲' : '▼';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
134
bibarts.sql
134
bibarts.sql
@@ -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 SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||||
SET time_zone = "+00:00";
|
SET time_zone = "+00:00";
|
||||||
|
|
||||||
--
|
|
||||||
-- Datenbank: `blog`
|
|
||||||
--
|
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
CREATE TABLE User (
|
CREATE TABLE user (
|
||||||
userid INT AUTO_INCREMENT PRIMARY KEY,
|
user_id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
vorname VARCHAR(50),
|
first_name VARCHAR(50),
|
||||||
nachname VARCHAR(50),
|
last_name VARCHAR(50),
|
||||||
strasse VARCHAR(100),
|
street VARCHAR(100),
|
||||||
hausnr VARCHAR(10),
|
house_number VARCHAR(10),
|
||||||
postleitzahl VARCHAR(10),
|
postal_code VARCHAR(10),
|
||||||
ort VARCHAR(50),
|
city VARCHAR(50),
|
||||||
land VARCHAR(50),
|
country VARCHAR(50),
|
||||||
tel VARCHAR(20),
|
phone VARCHAR(20),
|
||||||
email VARCHAR(100) UNIQUE,
|
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)
|
password VARCHAR(255)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE Standort (
|
CREATE TABLE location (
|
||||||
standortid INT AUTO_INCREMENT PRIMARY KEY,
|
location_id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
strasse VARCHAR(100),
|
street VARCHAR(100),
|
||||||
hausnr VARCHAR(10),
|
house_number VARCHAR(10),
|
||||||
plz VARCHAR(10),
|
postal_code VARCHAR(10),
|
||||||
ort VARCHAR(50),
|
city VARCHAR(50),
|
||||||
land VARCHAR(50),
|
country VARCHAR(50),
|
||||||
tel VARCHAR(20),
|
phone VARCHAR(20),
|
||||||
email VARCHAR(100)
|
email VARCHAR(100)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE Ausstellung (
|
CREATE TABLE event (
|
||||||
austellungid INT AUTO_INCREMENT PRIMARY KEY,
|
event_id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
standortid INT,
|
location_id INT,
|
||||||
datum_von DATE,
|
start_date DATE,
|
||||||
datum_bis DATE,
|
end_date DATE,
|
||||||
name VARCHAR(100),
|
name VARCHAR(100),
|
||||||
beschreibung TEXT,
|
description TEXT,
|
||||||
max_tickets INT,
|
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 (
|
CREATE TABLE ticket (
|
||||||
ticketid INT AUTO_INCREMENT PRIMARY KEY,
|
ticket_id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
userid INT,
|
user_id INT,
|
||||||
ausstellungid INT,
|
event_id INT,
|
||||||
kaufdatum DATE,
|
purchase_date DATE,
|
||||||
gueltigkeit DATE,
|
valid_until DATE,
|
||||||
preis DECIMAL(10,2),
|
FOREIGN KEY (user_id) REFERENCES user(user_id),
|
||||||
FOREIGN KEY (userid) REFERENCES User(userid),
|
FOREIGN KEY (event_id) REFERENCES event(event_id)
|
||||||
FOREIGN KEY (ausstellungid) REFERENCES Ausstellung(austellungid)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE Gutschein (
|
CREATE TABLE voucher (
|
||||||
gutscheinid INT AUTO_INCREMENT PRIMARY KEY,
|
voucher_id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
code VARCHAR(50) UNIQUE,
|
code VARCHAR(50) UNIQUE,
|
||||||
rabatt INT CHECK (rabatt BETWEEN 0 AND 100),
|
discount INT CHECK (discount BETWEEN 0 AND 100),
|
||||||
ausstellungid INT,
|
event_id INT,
|
||||||
gueltigkeit DATE,
|
valid_until DATE,
|
||||||
FOREIGN KEY (ausstellungid) REFERENCES Ausstellung(austellungid)
|
FOREIGN KEY (event_id) REFERENCES event(event_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE News (
|
CREATE TABLE news (
|
||||||
newsid INT AUTO_INCREMENT PRIMARY KEY,
|
news_id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
name VARCHAR(100),
|
name VARCHAR(100),
|
||||||
beschreibung TEXT,
|
description TEXT,
|
||||||
datum DATE
|
date DATE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- User-Daten
|
-- User-Daten (Passwort: passwort123)
|
||||||
INSERT INTO User (vorname, nachname, strasse, hausnr, postleitzahl, ort, land, tel, email, isAdmin, password)
|
INSERT INTO user (first_name, last_name, street, house_number, postal_code, city, country, phone, email, is_admin, password)
|
||||||
VALUES
|
VALUES
|
||||||
('Max', 'Muster', 'Musterstraße', '1', '12345', 'Musterstadt', 'Deutschland', '0123456789', 'max@muster.de', FALSE, 'passwort123'),
|
('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, 'adminpass');
|
('Anna', 'Beispiel', 'Beispielweg', '5a', '54321', 'Beispielstadt', 'Deutschland', '0987654321', 'anna@beispiel.de', TRUE, '$2y$10$cnPBpkvLbdpDxzYvxlQg9uVp5y8ggr2SWL8NAMg9zk.3QnnEl.MGq');
|
||||||
|
|
||||||
-- Standort-Daten
|
-- 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
|
VALUES
|
||||||
('Galeriestraße', '10', '10115', 'Berlin', 'Deutschland', '030123456', 'kontakt@galerie-berlin.de'),
|
('Galeriestraße', '10', '10115', 'Berlin', 'Deutschland', '030123456', 'kontakt@galerie-berlin.de'),
|
||||||
('Kunstallee', '22b', '50667', 'Köln', 'Deutschland', '0221123456', 'info@kunst-koeln.de');
|
('Kunstallee', '22b', '50667', 'Köln', 'Deutschland', '0221123456', 'info@kunst-koeln.de');
|
||||||
|
|
||||||
-- Ausstellung-Daten
|
-- 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
|
VALUES
|
||||||
(1, '2025-07-01', '2025-08-31', 'Moderne Meisterwerke', 'Eine Sammlung moderner Kunstwerke aus Europa.', 200),
|
(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);
|
(2, '2025-09-10', '2025-10-20', 'Kunst der Antike', 'Ausstellung antiker Skulpturen und Gemälde.', 150, 39.99);
|
||||||
|
|
||||||
-- Gutschein-Daten (Spaltennamen korrigiert)
|
-- Gutschein-Daten
|
||||||
INSERT INTO Gutschein (code, rabatt, ausstellungid, gueltigkeit)
|
INSERT INTO voucher (code, discount, event_id, valid_until)
|
||||||
VALUES
|
VALUES
|
||||||
('SOMMER2025', 15, 1, '2025-08-31'),
|
('SOMMER2025', 15, 1, '2025-08-31'),
|
||||||
('HERBST25', 25, 2, '2025-10-15');
|
('HERBST25', 25, 2, '2025-10-15');
|
||||||
|
|
||||||
-- Ticket-Daten (Spaltennamen korrigiert)
|
-- Ticket-Daten
|
||||||
INSERT INTO Ticket (userid, ausstellungid, kaufdatum, gueltigkeit, preis)
|
INSERT INTO ticket (user_id, event_id, purchase_date, valid_until)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, '2025-06-01', '2025-07-15', 12.50),
|
(1, 1, '2025-06-01', '2025-07-15'),
|
||||||
(2, 2, '2025-06-05', '2025-09-15', 10.00);
|
(2, 2, '2025-06-05', '2025-09-15');
|
||||||
|
|
||||||
-- News-Daten
|
-- News-Daten
|
||||||
INSERT INTO News (name, beschreibung, datum)
|
INSERT INTO news (name, description, date)
|
||||||
VALUES
|
VALUES
|
||||||
('Neuer Standort eröffnet', 'Unsere Galerie in Köln ist jetzt geöffnet!', '2025-06-01'),
|
('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');
|
75
index.php
75
index.php
@@ -1,45 +1,48 @@
|
|||||||
<?php
|
<?php
|
||||||
|
session_start();
|
||||||
|
include 'Views/header.phtml';
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
spl_autoload_register(function ($className) {
|
||||||
|
if (substr($className, 0, 5) !== 'Blog\\') {
|
||||||
|
// not our business
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
session_start();;;
|
$fileName = __DIR__.'/'.str_replace('\\', DIRECTORY_SEPARATOR, substr($className, 5)).'.php';
|
||||||
|
|
||||||
spl_autoload_register(function ($className) {
|
if (file_exists($fileName)) {
|
||||||
if (substr($className, 0, 5) !== 'Blog\\') {
|
include $fileName;
|
||||||
// not our business
|
}
|
||||||
return;
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$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";
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileName = __DIR__.'/'.str_replace('\\', DIRECTORY_SEPARATOR, substr($className, 5)).'.php';
|
$controllerClassName = 'Blog\\Controller\\'.ucfirst($controllerName).'Controller';
|
||||||
|
|
||||||
if (file_exists($fileName)) {
|
if (method_exists($controllerClassName, $doMethodName)) {
|
||||||
include $fileName;
|
$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';
|
||||||
$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);
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user