Compare commits
12 Commits
frontend
...
feature/au
Author | SHA1 | Date | |
---|---|---|---|
ce23d839a3 | |||
36d6364cd0 | |||
![]() |
5477e7fdd8 | ||
![]() |
db526e5bb2 | ||
![]() |
dd6e98fe28 | ||
![]() |
5965e1df81 | ||
![]() |
8d4376d313 | ||
![]() |
49a8f6a1dc | ||
![]() |
78e1e72eba | ||
![]() |
4fa775f326 | ||
1df705a235 | |||
5594d469de |
523
CSS/style.css
@@ -1,377 +1,202 @@
|
||||
*, *:before, *:after {
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #DFF0F2;
|
||||
color: black;
|
||||
background-color: #ffffff;
|
||||
color: #666;
|
||||
font-size: 15px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100vw;
|
||||
max-width: 100vw;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 10px;
|
||||
color: #4d4d4d;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
h1 span {
|
||||
color: orange;
|
||||
font-size: 40px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: orange;
|
||||
padding: 10px 0 0 10px;
|
||||
}
|
||||
|
||||
main {
|
||||
margin-top: 135px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#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;
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
background-color: #4d4d4d;
|
||||
color: white;
|
||||
}
|
||||
|
||||
a {
|
||||
color: black;
|
||||
.msg {
|
||||
text-align: center;
|
||||
font-size: 17px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.msg a {
|
||||
text-decoration: none;
|
||||
}
|
||||
#navigation {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1000;
|
||||
background: #BAC8D4;
|
||||
width: 100vw;
|
||||
}
|
||||
.link-container {
|
||||
display: grid;
|
||||
width: 80%;
|
||||
grid-template-columns: 20% 20% 56% 4%;
|
||||
background-color: #BAC8D4;
|
||||
border-bottom-right-radius: 10px;
|
||||
border-bottom-left-radius: 10px;
|
||||
}
|
||||
.links {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 25px;
|
||||
}
|
||||
#logo {
|
||||
height: 60px;
|
||||
width: 170px;
|
||||
background-image: url("../images/bibArts.png");
|
||||
background-position: center;
|
||||
background-size: contain;
|
||||
}
|
||||
#footer {
|
||||
position: relative;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 180px;
|
||||
background-color: #BAC8D4;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
z-index: 999;
|
||||
padding: 10px 0;
|
||||
color: #09add0;
|
||||
|
||||
}
|
||||
|
||||
.container-zahlungsmittel {
|
||||
grid-column: 5;
|
||||
justify-content: right;
|
||||
.msg a:hover {
|
||||
color: orange;
|
||||
}
|
||||
.header-zahlungsarten {
|
||||
padding-right: 15px;
|
||||
|
||||
nav ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
nav li {
|
||||
float: left;
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
|
||||
nav li a {
|
||||
display: block;
|
||||
width: 100px;
|
||||
height: 30px;
|
||||
border: 1px solid #4d4d4d;
|
||||
background-color: #4d4d4d;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
margin: 5px;
|
||||
text-align: center;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
nav li a:hover {
|
||||
background-color: orange;
|
||||
}
|
||||
|
||||
nav {
|
||||
position: fixed;
|
||||
background: white;
|
||||
top: 0px;
|
||||
width: 600px;
|
||||
text-align: center;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
#metanavi {
|
||||
color: #4d4d4d;
|
||||
font-weight: bold;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
#metanavi a {
|
||||
background: #09add0;
|
||||
border: none;
|
||||
width: 100px;
|
||||
margin: 0 5px 0 5px;
|
||||
float: right;
|
||||
padding: 2px;
|
||||
border-radius: 5px;
|
||||
color:#fff;
|
||||
cursor:pointer;
|
||||
font-size: 12px;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#metanavi a:hover {
|
||||
background: orange;
|
||||
}
|
||||
|
||||
.articleImg {
|
||||
width: 100%;
|
||||
border: 2px solid lightskyblue;
|
||||
padding: 5px;
|
||||
margin: 0 0 15px 0;
|
||||
}
|
||||
|
||||
.welcomeImg {
|
||||
width: 100%;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.articleInfo {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*** Formulare ***/
|
||||
|
||||
form {
|
||||
width: 440px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
label {
|
||||
width: 120px;
|
||||
display: inline-block;
|
||||
margin: 5px 15px 10px 0;
|
||||
vertical-align: top;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.inhalt {
|
||||
flex: 1 1 auto;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100vw;
|
||||
min-height: 0;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
padding: 0 2vw;
|
||||
box-sizing: border-box;
|
||||
label.errorMsg {
|
||||
width: 420px;
|
||||
display: inline-block;
|
||||
margin: 0 5px 15px 0;
|
||||
vertical-align: top;
|
||||
text-align: right;
|
||||
color: orange;
|
||||
}
|
||||
|
||||
.zahlungsmittel-img {
|
||||
height: 41px;
|
||||
width: 284px;
|
||||
background-image: url("../images/Zahlungsmittel.png");
|
||||
background-position: center;
|
||||
background-size: contain;
|
||||
justify-self: right;
|
||||
input {
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 97%;
|
||||
height: 1px;
|
||||
background-color: grey;
|
||||
justify-self: center;
|
||||
grid-column-start: 1;
|
||||
grid-column-end: 6;
|
||||
input[type="submit"] {
|
||||
width: 100px;
|
||||
margin-left: 330px;
|
||||
}
|
||||
|
||||
.container-rest {
|
||||
grid-column-start: 1;
|
||||
grid-column-end: 6;
|
||||
padding-left: 50px;
|
||||
form textarea {
|
||||
width: 300px;
|
||||
height: 150px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.link-impressum {
|
||||
padding-left: 30px;
|
||||
form select {
|
||||
width: 300px;
|
||||
}
|
||||
/*** Loesung Workshop-Seite ***/
|
||||
|
||||
}
|
||||
.text-bib {
|
||||
grid-column: 5;
|
||||
justify-self: right;
|
||||
padding-right: 30px;
|
||||
}
|
||||
.container-welcome-inhalt {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
width: 100%;
|
||||
max-width: 900px;
|
||||
min-height: 200px;
|
||||
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;
|
||||
.textContent {
|
||||
padding: 0 10px 0 30px;
|
||||
}
|
||||
|
||||
.beispiel-austellung1-img, .beispiel-austellung2-img {
|
||||
height: 200px;
|
||||
width: 90vw;
|
||||
max-width: 320px;
|
||||
background-position: center;
|
||||
background-size: contain;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.login-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;
|
||||
}
|
||||
|
||||
.tickets-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;
|
||||
}
|
||||
.tickets-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;
|
||||
}
|
||||
.tickets-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 (max-width: 529px) {
|
||||
.textContent {
|
||||
padding: 15px 0 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
.event h3 {
|
||||
margin: 15px 0 5px 0;
|
||||
font-size: 20px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.orange {
|
||||
color: orange;
|
||||
display: block;
|
||||
font-size: 18px;
|
||||
margin: 0 0 5px 0;
|
||||
}
|
170
Controller/AuthController.php
Normal file
@@ -0,0 +1,170 @@
|
||||
<?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 showAuthForm()
|
||||
{
|
||||
$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']);
|
||||
$this->view->render('auth/form');
|
||||
}
|
||||
|
||||
public function login() {
|
||||
$email = $_POST['email'];
|
||||
$password = $_POST['password'];
|
||||
|
||||
$result = $this->model->login($email, $password);
|
||||
|
||||
if ($result === true) {
|
||||
$_SESSION['user'] = $email;
|
||||
|
||||
$this->view->setVars([
|
||||
'loginSuccess' => true,
|
||||
'email' => $email
|
||||
]);
|
||||
} else {
|
||||
$this->view->setVars([
|
||||
'errors' => ['login' => is_string($result) ? $result : "Login fehlgeschlagen."],
|
||||
'validData' => ['email' => $email],
|
||||
'loginSuccess' => false
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function register() {
|
||||
$data = [
|
||||
'vorname' => $_POST['vorname'] ?? '',
|
||||
'nachname' => $_POST['nachname'] ?? '',
|
||||
'straße' => $_POST['straße'] ?? '',
|
||||
'hausnr' => $_POST['hausnr'] ?? '',
|
||||
'postleitzahl' => $_POST['postleitzahl'] ?? '',
|
||||
'ort' => $_POST['ort'] ?? '',
|
||||
'land' => $_POST['land'] ?? '',
|
||||
'tel' => $_POST['tel'] ?? '',
|
||||
'email' => $_POST['email'] ?? '',
|
||||
'password' => $_POST['password'] ?? '',
|
||||
'password_repeat' => $_POST['password_repeat'] ?? '',
|
||||
'isAdmin' => $_POST['isAdmin'] ?? false,
|
||||
];
|
||||
|
||||
$errors = [];
|
||||
|
||||
if (!$this->model->checkDoublePw($data['password'], $data['password_repeat'])) {
|
||||
$errors['password'] = "Passwörter stimmen nicht überein.";
|
||||
}
|
||||
|
||||
if ($this->pwRequirementCheck($data['password'])) {
|
||||
$errors
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
$result = $this->model->register($data);
|
||||
|
||||
if ($result === true) {
|
||||
$this->view->setVars([
|
||||
'success' => "Registrierung war erfolgreich."
|
||||
]);
|
||||
} else {
|
||||
$errors['register'] = is_string($result) ? $result : "Registrierung fehlgeschlagen.";
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->setVars([
|
||||
'errors' => $errors,
|
||||
'validData' => $data
|
||||
]);
|
||||
}
|
||||
|
||||
private 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;
|
||||
}
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
namespace Blog\Controller;
|
||||
|
||||
class LoginController {
|
||||
function showLoginPage(){
|
||||
|
||||
}
|
||||
function showPasswortVergessen(){
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
namespace Blog\Controller;
|
||||
|
||||
class ProfileController {
|
||||
function showProfile()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
namespace Blog\Controller;
|
||||
|
||||
class RegisterController {
|
||||
function showRegisterPage()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
namespace Blog\Controller;
|
||||
|
||||
class TicketsController {
|
||||
function showTickets()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
216
Model/AuthModel.php
Normal file
@@ -0,0 +1,216 @@
|
||||
<?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, validUntil 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['validUntil']);
|
||||
|
||||
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)
|
||||
{
|
||||
$rtn = $this->pwRequirementCheck($data['password']);
|
||||
if ($rtn !== true) {
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
if (!filter_var($data['email'], FILTER_VALIDATE_EMAIL)) {
|
||||
return "Bitte geben Sie eine gültige E-Mail ein.";
|
||||
}
|
||||
|
||||
$requiredFields = [
|
||||
'email', 'password', 'straße', 'hausnr', 'ort', 'postleitzahl',
|
||||
'land', 'vorname', 'nachname', 'tel'
|
||||
];
|
||||
|
||||
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.";
|
||||
}
|
||||
|
||||
$hashedPassword = password_hash($data['password'], PASSWORD_DEFAULT);
|
||||
|
||||
$sql = "INSERT INTO user (email, password, straße, hausnr, ort, postleitzahl, land,vorname, nachname, tel, isAdmin)
|
||||
VALUES (:email, :password, :straße, :hausnr, :ort, :postleitzahl, :land,:vorname, :nachname, :tel, :isAdmin)";
|
||||
|
||||
$params = [
|
||||
':email' => $data['email'],
|
||||
':password' => $hashedPassword,
|
||||
':straße' => $data['straße'],
|
||||
':hausnr' => $data['hausnr'],
|
||||
':ort' => $data['ort'],
|
||||
':postleitzahl'=> $data['postleitzahl'],
|
||||
':land'=> $data['land'],
|
||||
':vorname' => $data['vorname'],
|
||||
':nachname'=> $data['nachname'],
|
||||
':tel' => $data['tel'],
|
||||
':isAdmin' => $data['isAdmin'] ? 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 userid 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, validUntil = :validUntil
|
||||
WHERE email = :email";
|
||||
|
||||
$stmt = $pdo->prepare($sql);
|
||||
return $stmt->execute([
|
||||
':email' => $email,
|
||||
':password' => $hashedPassword,
|
||||
':validUntil' => $validUntil
|
||||
]);
|
||||
} 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 = "INSERT INTO user (email, password)
|
||||
VALUES (:email, :password)";
|
||||
|
||||
try{
|
||||
$pdo = $this->linkDB();
|
||||
$stmt = $pdo->prepare($sql);
|
||||
return $stmt->execute([
|
||||
':email' => $email,
|
||||
':password' => $hashedPassword,
|
||||
]);
|
||||
} 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;
|
||||
}
|
||||
}
|
33
Views/Auth/login.phtml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
include dirname(__DIR__).'/header.phtml';
|
||||
?>
|
||||
|
||||
<?php if (!empty($errors['login'])): ?>
|
||||
<div class="error">
|
||||
<?php echo htmlspecialchars($errors['login']); ?>
|
||||
</div>
|
||||
|
||||
<?php elseif (!empty($loginSuccess)): ?>
|
||||
<div class="msg">
|
||||
<p>Login für Benutzer <?php echo htmlspecialchars($_SESSION["user"]); ?> erfolgreich</p>
|
||||
<a href="?controller=Welcome&do=showWelcome">Weiter</a>
|
||||
</div>
|
||||
|
||||
<?php else: ?>
|
||||
<!-- Formular anzeigen -->
|
||||
<form method="post">
|
||||
<input type="hidden" name="controller" value="Auth">
|
||||
<input type="hidden" name="do" value="login">
|
||||
|
||||
<label for="email">E-Mail:</label>
|
||||
<input type="email" name="email" id="email" value="<?= htmlspecialchars($validData['email'] ?? '') ?>">
|
||||
|
||||
<label for="password">Passwort:</label>
|
||||
<input type="password" name="password" id="password">
|
||||
|
||||
<button type="submit">Einloggen</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
61
Views/Auth/register.phtml
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php include dirname(__DIR__).'/header.phtml'; ?>
|
||||
|
||||
<?php if (!empty($success)) : ?>
|
||||
<div class="success-message" style="color: green; margin-bottom: 1em;">
|
||||
<p><?php echo htmlspecialchars($success); ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($errors)) : ?>
|
||||
<div class="error-messages" style="color: red; margin-bottom: 1em;">
|
||||
<ul>
|
||||
<?php foreach ($errors as $field => $error) : ?>
|
||||
<li><?php echo htmlspecialchars($error); ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form action="?controller=Auth&do=register" method="post">
|
||||
<label for="vorname">Vorname:</label>
|
||||
<input type="text" name="vorname" id="vorname" value="<?php echo htmlspecialchars($validData['vorname'] ?? ''); ?>" required>
|
||||
|
||||
<label for="nachname">Nachname:</label>
|
||||
<input type="text" name="nachname" id="nachname" value="<?php echo htmlspecialchars($validData['nachname'] ?? ''); ?>" required>
|
||||
|
||||
<label for="straße">Straße:</label>
|
||||
<input type="text" name="straße" id="straße" value="<?php echo htmlspecialchars($validData['straße'] ?? ''); ?>" required>
|
||||
|
||||
<label for="hausnr">Hausnummer:</label>
|
||||
<input type="text" name="hausnr" id="hausnr" value="<?php echo htmlspecialchars($validData['hausnr'] ?? ''); ?>" required>
|
||||
|
||||
<label for="postleitzahl">Postleitzahl:</label>
|
||||
<input type="text" name="postleitzahl" id="postleitzahl" value="<?php echo htmlspecialchars($validData['postleitzahl'] ?? ''); ?>" required>
|
||||
|
||||
<label for="ort">Ort:</label>
|
||||
<input type="text" name="ort" id="ort" value="<?php echo htmlspecialchars($validData['ort'] ?? ''); ?>" required>
|
||||
|
||||
<label for="land">Land:</label>
|
||||
<input type="text" name="land" id="land" value="<?php echo htmlspecialchars($validData['land'] ?? ''); ?>" required>
|
||||
|
||||
<label for="tel">Telefonnummer:</label>
|
||||
<input type="text" name="tel" id="tel" value="<?php echo htmlspecialchars($validData['tel'] ?? ''); ?>">
|
||||
|
||||
<label for="email">E-Mail-Adresse:</label>
|
||||
<input type="email" name="email" id="email" value="<?php echo htmlspecialchars($validData['email'] ?? ''); ?>" required>
|
||||
|
||||
<label for="password">Passwort:</label>
|
||||
<input type="password" name="password" id="password" required>
|
||||
|
||||
<label for="password_repeat">Passwort wiederholen:</label>
|
||||
<input type="password" name="password_repeat" id="password_repeat" required>
|
||||
|
||||
<label for="isAdmin">
|
||||
<input type="checkbox" name="isAdmin" id="isAdmin" value="1" <?php echo (!empty($validData['isAdmin'])) ? 'checked' : ''; ?>>
|
||||
Admin-Rechte
|
||||
</label>
|
||||
|
||||
<button type="submit">Registrieren</button>
|
||||
</form>
|
||||
|
||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
12
Views/Contact/showConfirmation.phtml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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'; ?>
|
36
Views/Contact/showContactForm.phtml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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'; ?>
|
@@ -1,20 +0,0 @@
|
||||
<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" href="?controller=Login&do=showPasswortVergessen">Passwort vergessen?</a>
|
||||
<a class="link-konto-erstellen" href="?controller=Register&do=showRegisterPage">Konto erstellen</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -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>
|
||||
|
@@ -1,8 +0,0 @@
|
||||
<div class="inhalt">
|
||||
<div class="tickets-container">
|
||||
<h1>Tickets</h1>
|
||||
<div class="tickets-container-inhalt">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
21
Views/Welcome/showProjects.phtml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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'; ?>
|
21
Views/Welcome/showTutorials.phtml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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'; ?>
|
23
Views/Welcome/showWelcome.phtml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
include dirname(__DIR__).'/header.phtml';
|
||||
?>
|
||||
|
||||
<!-- <a href="?controller=guestbook&do=showGuestbookForm">Neuen Eintrag schreiben</a> -->
|
||||
<article>
|
||||
<h2>Willkommen</h2>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna felis sollicitudin mauris. Integer in mauris eu nibh euismod gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue, eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis, neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis, molestie eu, feugiat in, orci. In hac habitasse platea dictumst.
|
||||
</p>
|
||||
<p>
|
||||
Fusce convallis, mauris imperdiet gravida bibendum, nisl turpis suscipit mauris, sed placerat ipsum urna sed risus. In convallis tellus a mauris. Curabitur non elit ut libero tristique sodales. Mauris a lacus. Donec mattis semper leo. In hac habitasse platea dictumst. Vivamus facilisis diam at odio. Mauris dictum, nisi eget consequat elementum, lacus ligula molestie metus, non feugiat orci magna ac sem. Donec turpis. Donec vitae metus. Morbi tristique neque eu mauris. Quisque gravida ipsum non sapien. Proin turpis lacus, scelerisque vitae, elementum at, lobortis ac, quam. Aliquam dictum eleifend risus. In hac habitasse platea dictumst. Etiam sit amet diam. Suspendisse odio. Suspendisse nunc. In semper bibendum libero.
|
||||
</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>
|
||||
</article>
|
||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
||||
|
@@ -1,13 +1,5 @@
|
||||
<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>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="HTML-5">
|
||||
<html>
|
||||
<head>
|
||||
<title>VR Contact</title>
|
||||
<meta charset="UTF-8" />
|
||||
@@ -7,30 +7,19 @@
|
||||
<link href="CSS/style.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<nav id="navigation">
|
||||
<div class="link-container">
|
||||
<div id="logo" ><a class="link-logo" href="#"></a></div>
|
||||
<button id="nav-toggle-btn" aria-label="Menü ein-/ausklappen">▼</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>
|
||||
<div id="profile-picture"></div>
|
||||
<div id="wrapper">
|
||||
<nav>
|
||||
<div id="metanavi">
|
||||
<a href="#">Anmelden</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<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>
|
||||
<h1><span>V</span>irtual <span>R</span>evolution</h1>
|
||||
<ul>
|
||||
<li><a href="?controller=Welcome&do=showWelcome">Willkommen</a></li>
|
||||
<li><a href="#">Projekte</a></li>
|
||||
<li><a href="#">Workshops</a></li>
|
||||
<li><a href="?controller=Contact&do=showContactForm">Kontakt</a></li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<main>
|
138
bibarts.sql
Normal file
@@ -0,0 +1,138 @@
|
||||
CREATE TABLE user (
|
||||
userid INT AUTO_INCREMENT PRIMARY KEY,
|
||||
vorname VARCHAR(50),
|
||||
nachname VARCHAR(50),
|
||||
straße VARCHAR(100),
|
||||
hausnr VARCHAR(10),
|
||||
postleitzahl VARCHAR(10),
|
||||
ort VARCHAR(50),
|
||||
land VARCHAR(50),
|
||||
tel VARCHAR(20),
|
||||
email VARCHAR(100) UNIQUE,
|
||||
isAdmin BOOLEAN DEFAULT FALSE,
|
||||
password VARCHAR(255)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE standort (
|
||||
standortid INT AUTO_INCREMENT PRIMARY KEY,
|
||||
straße VARCHAR(100),
|
||||
hausnr VARCHAR(10),
|
||||
postleitzahl VARCHAR(10),
|
||||
ort VARCHAR(50),
|
||||
land VARCHAR(50),
|
||||
tel VARCHAR(20),
|
||||
email VARCHAR(100)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE ausstellung (
|
||||
austellungid INT AUTO_INCREMENT PRIMARY KEY,
|
||||
standortid INT,
|
||||
datum_von DATE,
|
||||
datum_bis DATE,
|
||||
name VARCHAR(100),
|
||||
beschreibung TEXT,
|
||||
max_tickets INT,
|
||||
FOREIGN KEY (standortid) REFERENCES Standort(standortid)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE ticket (
|
||||
ticketid INT AUTO_INCREMENT PRIMARY KEY,
|
||||
userid INT,
|
||||
eventid INT,
|
||||
kaufdatum DATE,
|
||||
gültigkeitsdatum DATE,
|
||||
preis DECIMAL(10,2),
|
||||
FOREIGN KEY (userid) REFERENCES User(userid),
|
||||
FOREIGN KEY (eventid) REFERENCES Ausstellung(austellungid)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE gutschein (
|
||||
gutscheinid INT AUTO_INCREMENT PRIMARY KEY,
|
||||
code VARCHAR(50) UNIQUE,
|
||||
rabatt INT CHECK (rabatt BETWEEN 0 AND 100),
|
||||
eventid INT,
|
||||
gültigkeit DATE,
|
||||
FOREIGN KEY (eventid) REFERENCES Ausstellung(austellungid)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE news (
|
||||
newsid INT AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(100),
|
||||
beschreibung TEXT,
|
||||
datum DATE
|
||||
);
|
||||
|
||||
--Testdaten
|
||||
|
||||
INSERT INTO user (vorname, nachname, straße, hausnr, postleitzahl, ort, land, tel, email, isAdmin, 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');
|
||||
|
||||
|
||||
INSERT INTO standort (straße, hausnr, postleitzahl, ort, land, tel, email)
|
||||
VALUES
|
||||
('Galeriestraße', '10', '10115', 'Berlin', 'Deutschland', '030123456', 'kontakt@galerie-berlin.de'),
|
||||
('Kunstallee', '22b', '50667', 'Köln', 'Deutschland', '0221123456', 'info@kunst-koeln.de');
|
||||
|
||||
|
||||
INSERT INTO ausstellung (standortid, datum_von, datum_bis, name, beschreibung, max_tickets)
|
||||
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);
|
||||
|
||||
|
||||
INSERT INTO gutschein (code, rabatt, eventid, gültigkeit)
|
||||
VALUES
|
||||
('SOMMER2025', 15, 1, '2025-08-31'),
|
||||
('HERBST25', 25, 2, '2025-10-15');
|
||||
|
||||
|
||||
INSERT INTO ticket (userid, eventid, kaufdatum, gültigkeitsdatum, preis)
|
||||
VALUES
|
||||
(1, 1, '2025-06-01', '2025-07-15', 12.50),
|
||||
(2, 2, '2025-06-05', '2025-09-15', 10.00);
|
||||
|
||||
|
||||
INSERT INTO news (name, beschreibung, datum)
|
||||
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');
|
||||
|
||||
--Änderungen:
|
||||
|
||||
ALTER TABLE austellung
|
||||
ADD preis decimal NOT NULL
|
||||
|
||||
ALTER TABLE ticket
|
||||
DROP COLUMN preis
|
||||
|
||||
|
||||
ALTER TABLE user
|
||||
MODIFY COLUMN userid INT NOT NULL AUTO_INCREMENT;
|
||||
|
||||
ALTER TABLE ticket
|
||||
MODIFY COLUMN ticketid INT NOT NULL AUTO_INCREMENT;
|
||||
|
||||
ALTER TABLE standort
|
||||
MODIFY COLUMN standortid INT NOT NULL AUTO_INCREMENT;
|
||||
|
||||
ALTER TABLE news
|
||||
MODIFY COLUMN newsid INT NOT NULL AUTO_INCREMENT;
|
||||
|
||||
ALTER TABLE gutschein
|
||||
MODIFY COLUMN gutscheinid INT NOT NULL AUTO_INCREMENT;
|
||||
|
||||
ALTER TABLE ausstellung
|
||||
MODIFY COLUMN austellungid INT NOT NULL AUTO_INCREMENT;
|
||||
|
||||
ALTER TABLE user
|
||||
MODIFY COLUMN isAdmin BOOLEAN DEFAULT FALSE;
|
||||
|
||||
ALTER TABLE user
|
||||
ADD validUntil DATETIME NOT NULL DEFAULT '3025-01-01 00:00:00';
|
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 855 KiB |
Before Width: | Height: | Size: 2.1 MiB |
Before Width: | Height: | Size: 29 KiB |
BIN
images/controller.jpg
Normal file
After Width: | Height: | Size: 5.5 KiB |
BIN
images/gtx-1080-ti.jpg
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
images/museum.jpg
Normal file
After Width: | Height: | Size: 100 KiB |
BIN
images/oculus.jpg
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
images/oculus_2.jpg
Normal file
After Width: | Height: | Size: 16 KiB |
79
index.php
@@ -1,50 +1,45 @@
|
||||
<?php
|
||||
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;
|
||||
}
|
||||
<?php
|
||||
|
||||
$fileName = __DIR__.'/'.str_replace('\\', DIRECTORY_SEPARATOR, substr($className, 5)).'.php';
|
||||
session_start();;;
|
||||
|
||||
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";
|
||||
}
|
||||
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();
|
||||
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";
|
||||
}
|
||||
|
||||
$view->render();
|
||||
$controllerClassName = 'Blog\\Controller\\'.ucfirst($controllerName).'Controller';
|
||||
|
||||
} else {
|
||||
new \Blog\Library\ErrorMsg('Page not found: '.$controllerClassName.'::'.$doMethodName);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
include 'Views/footer.phtml';
|
||||
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);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|