Fixed minor bugs

Fixed spelling
Fixed layout
This commit is contained in:
Furentes
2019-05-22 23:36:06 +02:00
parent cc3073803d
commit 76ea941123
9 changed files with 127 additions and 94 deletions

View File

@ -9,6 +9,7 @@
<label for="bmenub" class="burger pseudo button">&#8801;</label> <label for="bmenub" class="burger pseudo button">&#8801;</label>
<div class="menu"> <div class="menu">
<a href="/" class="pseudo button"">Startseite</a>
<?php <?php
if ($auth->hasRole([ \Bloggr\Roles::ADMIN ])){ if ($auth->hasRole([ \Bloggr\Roles::ADMIN ])){
?> ?>
@ -17,8 +18,7 @@
<?php <?php
} elseif($auth->hasRole([ \Bloggr\Roles::AUTHOR ])) { } elseif($auth->hasRole([ \Bloggr\Roles::AUTHOR ])) {
?> ?>
<a href="/settings.php" class="pseudo button">Einstellungen</a> <a href="/post.php?new" class="pseudo button">Neuer Post</a>
<a href="/logout.php" class="button">Logout</a>
<?php <?php
} }
?> ?>

View File

@ -17,13 +17,17 @@ require_once(__DIR__."/inc/head.php");
if ($posts) { if ($posts) {
foreach($posts as $post) { foreach($posts as $post) {
?> ?>
<p> <article class="card">
<header>
<h2><a href="/post.php?view=<?= $post['id'] ?>"><?= $post['title'] ?></a></h2> <h2><a href="/post.php?view=<?= $post['id'] ?>"><?= $post['title'] ?></a></h2>
</header>
<p> <p>
<?= substr($post['text'], 0, 512) ?><?= (substr($post['text'], 0, 512) !== $post['text']) ? '... <br><a href="/post.php?view='.$post["id"].'">Weiterlesen...</a>' : '' ?> <?= substr($post['text'], 0, 512) ?><?= (substr($post['text'], 0, 512) !== $post['text']) ? '... <br><a href="/post.php?view='.$post["id"].'">Weiterlesen...</a>' : '' ?>
</p> </p>
<p><small>von <?= $post['user'] ?> am <?= date('H:i d.m.Y', $post['created_at']) ?></p> <footer>
</p> <p><small>von <?= $post['user'] ?> am <?= date('H:i d.m.Y', $post['created_at']) ?></small></p>
</footer>
</article>
<?php <?php
} }
} else { } else {

View File

@ -16,19 +16,19 @@ class Auth
$password = filter_var($password, FILTER_SANITIZE_STRING); $password = filter_var($password, FILTER_SANITIZE_STRING);
$timestamp = time(); $timestamp = time();
if (preg_replace('/\s+/', '', $username) !== $username) { if (preg_replace('/\s+/', '', $username) !== $username) {
array_push($errors, 'Your username may not contain whitespaces!'); array_push($errors, 'Dein Benutzername darf keine Leerzeichen enthalten!');
} }
if (strlen(trim($username)) < 3) { if (strlen(trim($username)) < 3) {
array_push($errors, 'Username is too short! Min. 3'); array_push($errors, 'Der Benutzername ist zu kurz! Min. 3');
} }
if (strlen(trim($username)) > 16) { if (strlen(trim($username)) > 16) {
array_push($errors, 'Username is too long! Max. 16'); array_push($errors, 'Der Benutzername ist zu lang! Max. 16');
} }
if (!$email) { if (!$email) {
array_push($errors, 'Enter a valid email!'); array_push($errors, 'Ungültige E-Mail!');
} }
if (strlen(trim($password)) < 8) { if (strlen(trim($password)) < 8) {
array_push($errors, 'Password is too short! Min 8'); array_push($errors, 'Passwort zu kurz! Min 8');
} }
if (count($errors) > 0) { if (count($errors) > 0) {
return $errors; return $errors;
@ -41,14 +41,14 @@ class Auth
)); ));
while ($row = $s->fetch()) { while ($row = $s->fetch()) {
if ($row['username'] === $username) { if ($row['username'] === $username) {
array_push($errors, 'Username already exists!'); array_push($errors, 'Benutzer existiert bereits!');
} }
if ($row['email'] === $email) { if ($row['email'] === $email) {
array_push($errors, 'Email already exists!'); array_push($errors, 'E-Mail existiert bereits!');
} }
} }
} catch (\PDOException $e) { } catch (\PDOException $e) {
array_push($errors, 'Something went wrong!'); array_push($errors, 'Da ist etwas schiefgelaufen!');
} }
if (count($errors) > 0) { if (count($errors) > 0) {
return $errors; return $errors;
@ -63,10 +63,10 @@ class Auth
':roles_mask' => $role ':roles_mask' => $role
)); ));
if(!$r) { if(!$r) {
array_push($errors, 'Something went wrong!'); array_push($errors, 'Da ist etwas schiefgelaufen!');
} }
} catch (\PDOException $e) { } catch (\PDOException $e) {
array_push($errors, 'Something went wrong!'); array_push($errors, 'Da ist etwas schiefgelaufen!');
} }
if (count($errors) > 0) { if (count($errors) > 0) {
return $errors; return $errors;
@ -78,10 +78,10 @@ class Auth
$password = filter_var($password, FILTER_SANITIZE_STRING); $password = filter_var($password, FILTER_SANITIZE_STRING);
$timestamp = time(); $timestamp = time();
if (!$user || $user === '' || preg_replace('/\s+/', '', $user) !== $user) { if (!$user || $user === '' || preg_replace('/\s+/', '', $user) !== $user) {
array_push($errors, 'Please enter a username or email!'); array_push($errors, 'Kein Benutzername oder E-Mail angegeben!');
} }
if (!$password || $password === '') { if (!$password || $password === '') {
array_push($errors, 'Please enter a password!'); array_push($errors, 'Kein Passwort angegeben!');
} }
if (count($errors) > 0) { if (count($errors) > 0) {
return $errors; return $errors;
@ -93,17 +93,17 @@ class Auth
':user' => $user ':user' => $user
)); ));
if ($s->rowCount() <= 0) { if ($s->rowCount() <= 0) {
array_push($errors, 'Wrong username/email or password!'); array_push($errors, 'Falscher Benutzername/E-Mail oder Passwort!');
} else { } else {
while ($row = $s->fetch()) { while ($row = $s->fetch()) {
if (!password_verify($password, $row['password'])) { if (!password_verify($password, $row['password'])) {
array_push($errors, 'Wrong username/email or password!'); array_push($errors, 'Falscher Benutzername/E-Mail oder Passwort!');
} }
$userId = $row['id']; $userId = $row['id'];
} }
} }
} catch (\PDOException $e) { } catch (\PDOException $e) {
array_push($errors, 'Something went wrong!'); array_push($errors, 'Da ist etwas schiefgelaufen!');
} }
if (count($errors) > 0) { if (count($errors) > 0) {
return $errors; return $errors;
@ -115,10 +115,10 @@ class Auth
':id' => $userId ':id' => $userId
)); ));
if(!$r) { if(!$r) {
array_push($errors, 'Something went wrong!'); array_push($errors, 'Da ist etwas schiefgelaufen!');
} }
} catch (\PDOException $e) { } catch (\PDOException $e) {
array_push($errors, 'Something went wrong!'); array_push($errors, 'Da ist etwas schiefgelaufen!');
} }
if (count($errors) > 0) { if (count($errors) > 0) {
return $errors; return $errors;
@ -204,19 +204,19 @@ class Auth
$title = htmlspecialchars(trim(filter_var($title, FILTER_SANITIZE_STRING))); $title = htmlspecialchars(trim(filter_var($title, FILTER_SANITIZE_STRING)));
$text = htmlspecialchars(trim($text, FILTER_SANITIZE_STRING)); $text = htmlspecialchars(trim($text, FILTER_SANITIZE_STRING));
$created_at = time(); $created_at = time();
$id = [ 'Something went wrong!' ]; $id = [ 'Da ist etwas schiefgelaufen!' ];
if (strlen($title) < 3) { if (strlen($title) < 3) {
array_push($errors, 'Title is too short! Min. 3'); array_push($errors, 'Titel ist zu kurz! Min. 3');
} }
if (strlen($title) > 64) { if (strlen($title) > 64) {
array_push($errors, 'Title is too long! Max. 64'); array_push($errors, 'Titel ist zu lang! Max. 64');
} }
if (strlen($text) < 8) { if (strlen($text) < 8) {
array_push($errors, 'Text is too short! Min. 8'); array_push($errors, 'Text ist zu kurz! Min. 8');
} }
if (strlen($text) > 12000000) { if (strlen($text) > 12000000) {
array_push($errors, 'Text is too long! MAx. 10M'); array_push($errors, 'Text ist zu lang! Max. 10M');
} }
if (count($errors) > 0) { if (count($errors) > 0) {
return $errors; return $errors;
@ -231,10 +231,10 @@ class Auth
)); ));
$id = $this->pdo->lastInsertId(); $id = $this->pdo->lastInsertId();
if(!$r) { if(!$r) {
array_push($errors, 'Something went wrong!'); array_push($errors, 'Da ist etwas schiefgelaufen!');
} }
} catch (\PDOException $e) { } catch (\PDOException $e) {
array_push($errors, 'Something went wrong!'); array_push($errors, 'Da ist etwas schiefgelaufen!');
} }
if (count($errors) > 0) { if (count($errors) > 0) {
return $errors; return $errors;
@ -272,9 +272,8 @@ class Auth
$updated_at = time(); $updated_at = time();
try { try {
$s = $this->pdo->prepare("SELECT posts.* FROM posts INNER JOIN users ON posts.user = users.id WHERE posts.user = :user AND posts.id = :post LIMIT 1;"); $s = $this->pdo->prepare("SELECT posts.* FROM posts INNER JOIN users ON posts.user = users.id WHERE posts.id = :post LIMIT 1;");
$s->execute(array( $s->execute(array(
':user' => $this->getId(),
':post' => $id, ':post' => $id,
)); ));
@ -282,20 +281,20 @@ class Auth
return false; return false;
} }
} catch (\PDOException $e) { } catch (\PDOException $e) {
array_push($errors, 'Something went wrong!'); array_push($errors, 'Da ist etwas schiefgelaufen!');
} }
if (strlen($title) < 3) { if (strlen($title) < 3) {
array_push($errors, 'Title is too short! Min. 3'); array_push($errors, 'Titel ist zu kurz! Min. 3');
} }
if (strlen($title) > 64) { if (strlen($title) > 64) {
array_push($errors, 'Title is too long! Max. 64'); array_push($errors, 'Titel ist zu lang! Max. 64');
} }
if (strlen($text) < 8) { if (strlen($text) < 8) {
array_push($errors, 'Text is too short! Min. 8'); array_push($errors, 'Text ist zu kurz! Min. 8');
} }
if (strlen($text) > 12000000) { if (strlen($text) > 12000000) {
array_push($errors, 'Text is too long! MAx. 10M'); array_push($errors, 'Text ist zu lang! Max. 10M');
} }
if (count($errors) > 0) { if (count($errors) > 0) {
return $errors; return $errors;
@ -310,10 +309,10 @@ class Auth
':id' => $id, ':id' => $id,
)); ));
if(!$r) { if(!$r) {
array_push($errors, 'Something went wrong!'); array_push($errors, 'Da ist etwas schiefgelaufen!');
} }
} catch (\PDOException $e) { } catch (\PDOException $e) {
array_push($errors, 'Something went wrong!'); array_push($errors, 'Da ist etwas schiefgelaufen!');
} }
if (count($errors) > 0) { if (count($errors) > 0) {
return $errors; return $errors;
@ -351,7 +350,7 @@ class Auth
public function getAllPosts() { public function getAllPosts() {
try { try {
$posts = []; $posts = [];
$sql = "SELECT * FROM posts ORDER BY id ASC"; $sql = "SELECT * FROM posts ORDER BY id DESC";
$result = $this->pdo->query($sql); $result = $this->pdo->query($sql);
if (!$result) { if (!$result) {
@ -378,10 +377,10 @@ class Auth
$comment = htmlspecialchars(trim($comment, FILTER_SANITIZE_STRING)); $comment = htmlspecialchars(trim($comment, FILTER_SANITIZE_STRING));
$created_at = time(); $created_at = time();
if (strlen($comment) < 3) { if (strlen($comment) < 3) {
array_push($errors, 'Text is too short! Min. 3'); array_push($errors, 'Text ist zu kurz! Min. 3');
} }
if (strlen($comment) > 256) { if (strlen($comment) > 256) {
array_push($errors, 'Text is too long! Max. 256'); array_push($errors, 'Text ist zu lang! Max. 256');
} }
if (count($errors) > 0) { if (count($errors) > 0) {
return $errors; return $errors;
@ -395,14 +394,14 @@ class Auth
':created_at' => $created_at, ':created_at' => $created_at,
)); ));
if(!$r) { if(!$r) {
array_push($errors, 'Something went wrong!'); array_push($errors, 'Da ist etwas schiefgelaufen!');
} }
if (count($errors) > 0) { if (count($errors) > 0) {
return $errors; return $errors;
} }
return true; return true;
} catch (\PDOException $e) { } catch (\PDOException $e) {
array_push($errors, 'Something went wrong!'); array_push($errors, 'Da ist etwas schiefgelaufen!');
} }
if (count($errors) > 0) { if (count($errors) > 0) {
return $errors; return $errors;
@ -476,10 +475,10 @@ class Auth
':id' => $id, ':id' => $id,
)); ));
if(!$r) { if(!$r) {
array_push($errors, 'Something went wrong!'); array_push($errors, 'Da ist etwas schiefgelaufen!');
} }
} catch (\PDOException $e) { } catch (\PDOException $e) {
array_push($errors, 'Something went wrong!'); array_push($errors, 'Da ist etwas schiefgelaufen!');
} }
if (count($errors) > 0) { if (count($errors) > 0) {
return $errors; return $errors;
@ -500,25 +499,25 @@ class Auth
':id' => $this->getId() ':id' => $this->getId()
)); ));
if ($s->rowCount() <= 0) { if ($s->rowCount() <= 0) {
array_push($errors, 'User not found!'); array_push($errors, 'Benutzer nicht gefunden!');
} else { } else {
while ($row = $s->fetch()) { while ($row = $s->fetch()) {
if (!password_verify($old, $row['password'])) { if (!password_verify($old, $row['password'])) {
array_push($errors, 'Wrong password!'); array_push($errors, 'Falsches Passwort!');
} }
} }
} }
} catch (\PDOException $e) { } catch (\PDOException $e) {
array_push($errors, 'Something went wrong!'); array_push($errors, 'Da ist etwas schiefgelaufen!');
} }
if (count($errors) > 0) { if (count($errors) > 0) {
return $errors; return $errors;
} }
if ($new != $repeat) { if ($new != $repeat) {
array_push($errors, 'Password repeat wrong!'); array_push($errors, 'Passwörter sind nicht gleich!');
} }
if (strlen(trim($new)) < 8) { if (strlen(trim($new)) < 8) {
array_push($errors, 'Password is too short! Min 8'); array_push($errors, 'Passwort zu kurz! Min. 8');
} }
if (count($errors) > 0) { if (count($errors) > 0) {
return $errors; return $errors;
@ -534,10 +533,10 @@ class Auth
':id' => $this->getId(), ':id' => $this->getId(),
)); ));
if(!$r) { if(!$r) {
array_push($errors, 'Something went wrong!'); array_push($errors, 'Da ist etwas schiefgelaufen!');
} }
} catch (\PDOException $e) { } catch (\PDOException $e) {
array_push($errors, 'Something went wrong!'); array_push($errors, 'Da ist etwas schiefgelaufen!');
} }
if (count($errors) > 0) { if (count($errors) > 0) {
return $errors; return $errors;

View File

@ -24,7 +24,6 @@ require_once(__DIR__."/inc/head.php");
<?php require_once(__DIR__."/inc/nav.php"); ?> <?php require_once(__DIR__."/inc/nav.php"); ?>
<section class="main"> <section class="main">
<h2>Login</h2> <h2>Login</h2>
<?php <?php
foreach ($errors as $key=>$value): foreach ($errors as $key=>$value):
?> ?>

View File

@ -12,25 +12,32 @@ $errors = [];
$action = ''; $action = '';
$data = []; $data = [];
$success = false; $success = false;
$title = "404 Not Found";
if (isset($_GET['view'])) { if (isset($_GET['view'])) {
if (isset($_POST['comment'])) { if (isset($_POST['comment'])) {
$result = $auth->commentPost($_GET['view'], $_POST['comment']); $result = $auth->commentPost($_GET['view'], $_POST['comment']);
if (is_array($result)) {
$errors = $result;
}
} }
$result = $auth->getPost($_GET['view']); $result = $auth->getPost($_GET['view']);
$result_comments = $auth->getPostComments($_GET['view']); $result_comments = $auth->getPostComments($_GET['view']);
if(!$result) { if(!$result) {
array_push($errors, '404 Not Found'); array_push($errors, '404 Not Found');
} else { } else {
$title = $result['title'];
$action = 'view'; $action = 'view';
$data = $result; $data = $result;
} }
} }
else if (isset($_GET['new'])) { else if (isset($_GET['new'])) {
$action = 'new'; $action = 'new';
$title = "Neuer Beitrag";
} }
else if (isset($_GET['edit'])) { else if (isset($_GET['edit'])) {
$action = 'edit'; $action = 'edit';
$title = "Beitrag bearbeitem";
} }
else { else {
array_push($errors, '404 Not Found'); array_push($errors, '404 Not Found');
@ -46,7 +53,7 @@ if ($action == 'new' && isset($_POST['new'])) {
} }
} }
$title = ""; $ptitle = "";
$text = ""; $text = "";
if ($action == 'edit' && isset($_POST['edit'])) { if ($action == 'edit' && isset($_POST['edit'])) {
@ -71,13 +78,18 @@ if ($action == 'edit') {
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<?php <?php
$title = "Neuer Beitrag";
require_once(__DIR__."/inc/head.php"); require_once(__DIR__."/inc/head.php");
?> ?>
<body> <body>
<?php require_once(__DIR__."/inc/nav.php"); ?> <?php require_once(__DIR__."/inc/nav.php"); ?>
<section class="main"> <section class="main">
<a href="/">Zurück</a> <?php
if ($action == 'edit' && (count($errors) <= 0)) {
echo '<a href="/post.php?view='.$data["id"].'">Zurück</a>';
} else {
echo '<a href="/">Zurück</a>';
}
?>
<?php <?php
foreach ($errors as $key=>$value): foreach ($errors as $key=>$value):
?> ?>
@ -92,9 +104,12 @@ require_once(__DIR__."/inc/head.php");
} }
if ($action == 'view'): if ($action == 'view'):
?> ?>
<h2><?= $data['title'] ?></h2> <div>
<header><h2><?= $data['title'] ?></h2></header>
<section>
<p><?= nl2br($data['text']) ?></p> <p><?= nl2br($data['text']) ?></p>
<p><small>von <?= $data['user'] ?> am <?= date('H:i d.m.Y', $data['created_at']) ?><br> </section>
<footer><small>von <?= $data['user'] ?> am <?= date('H:i d.m.Y', $data['created_at']) ?><br>
<?php <?php
if($data['updated_by']): if($data['updated_by']):
?> ?>
@ -102,9 +117,10 @@ require_once(__DIR__."/inc/head.php");
</small> </small>
<?php <?php
endif; endif;
echo '</p>';
if ($auth->canEditPost($data["id"]) == true) echo '<a href="post.php?edit='.$data["id"].'">Edit Post</a>'; if ($auth->canEditPost($data["id"]) == true) echo '<a href="post.php?edit='.$data["id"].'">Edit Post</a>';
echo '</footer>';
?> ?>
</div>
<?php <?php
if ($auth->isLoggedIn()) { if ($auth->isLoggedIn()) {
?> ?>
@ -120,10 +136,14 @@ require_once(__DIR__."/inc/head.php");
if(is_array($result_comments)) { if(is_array($result_comments)) {
foreach($result_comments as $comment) { foreach($result_comments as $comment) {
?> ?>
<p> <article class="card">
<b><?= $comment['user']; ?></b> am <?= date('H:i d.m.Y',$comment['created_at']) ?><br> <section>
<b><?= $comment['user']; ?></b> <small>am <?= date('H:i d.m.Y',$comment['created_at']) ?></small>
</section>
<footer>
<?= $comment['comment']; ?> <?= $comment['comment']; ?>
</p> </footer>
</article>
<?php <?php
} }
} }
@ -143,15 +163,15 @@ require_once(__DIR__."/inc/head.php");
<?php <?php
endif; endif;
if ($action == 'edit' && (count($errors) <= 0)): if ($action == 'edit'):
?> ?>
<h2>Beitrag Bearbeiten</h2> <h2>Beitrag Bearbeiten</h2>
<form action="<?= htmlspecialchars($_SERVER['REQUEST_URI']) ?>" method="post" class="clearfix"> <form action="<?= htmlspecialchars($_SERVER['REQUEST_URI']) ?>" method="post" class="clearfix">
<label for="title">Titel</label> <label for="title">Titel</label>
<input type="text" name="title" id="title" value="<?= (isset($data['title'])) ? $data['title'] : $title; ?>"><br> <input type="text" name="title" id="title" value="<?= (isset($data['title'])) ? $data['title'] : $ptitle; ?>"><br>
<label for="text">Text</label> <label for="text">Text</label>
<textarea rows="4" cols="50" name="text" id="text"><?= (isset($data['text'])) ? $data['text'] : $text; ?></textarea> <textarea rows="4" cols="50" name="text" id="text"><?= (isset($data['text'])) ? $data['text'] : $text; ?></textarea>
<input type="submit" name="edit" value="edit"> <input type="submit" name="edit" value="Speichern">
</form> </form>
<?php <?php
endif; endif;

View File

@ -8,7 +8,7 @@ $errors = [];
$success = false; $success = false;
if (isset($_POST['register'])) { if (isset($_POST['register'])) {
if ($_POST['password'] !== $_POST['password2']) { if ($_POST['password'] !== $_POST['password2']) {
array_push($errors, 'Passwörter sind nicht gleich'); array_push($errors, 'Passwörter sind nicht gleich!');
} else { } else {
$register = $auth->register($_POST['username'], $_POST['email'], $_POST['password']); $register = $auth->register($_POST['username'], $_POST['email'], $_POST['password']);
if (is_array($register)) { if (is_array($register)) {

View File

@ -33,7 +33,7 @@ require_once(__DIR__."/inc/head.php");
<body> <body>
<?php require_once(__DIR__."/inc/nav.php"); ?> <?php require_once(__DIR__."/inc/nav.php"); ?>
<section class="main"> <section class="main">
<h2>Change Password</h2> <h2>Einstellungen</h2>
<?php <?php
foreach ($errors as $key=>$value): foreach ($errors as $key=>$value):
?> ?>

View File

@ -27,13 +27,13 @@ if (isset($_POST['check']) || isset($_POST['submit'])) {
$pass = $_POST['ADMIN_PASS']; $pass = $_POST['ADMIN_PASS'];
if($siteTitle == "" || strlen($siteTitle) < 1) { if($siteTitle == "" || strlen($siteTitle) < 1) {
array_push($error, "Please enter a site title"); array_push($error, "Bitte gib einen Seitentitel ein.");
} }
if($dbHost == "") { if($dbHost == "") {
array_push($error, "Please enter a hostname"); array_push($error, "Bitte gib einen Hostnamen ein.");
} }
if($dbName == "") { if($dbName == "") {
array_push($error, "Please enter a database"); array_push($error, "Bitte gib eine Datenbank an.");
} }
if (isset($_POST['submit'])) { if (isset($_POST['submit'])) {
@ -62,7 +62,7 @@ if (isset($_POST['check'])) {
$sql = file_get_contents(__DIR__."/lib/sql/db.sql"); $sql = file_get_contents(__DIR__."/lib/sql/db.sql");
try { try {
$pdo->exec($sql); $pdo->exec($sql);
array_push($successArray, 'Database setup complete...'); array_push($successArray, 'Tabellen erstellt...!');
} catch (PDOException $ex) { } catch (PDOException $ex) {
array_push($error, $ex->getMessage()); array_push($error, $ex->getMessage());
} }
@ -77,7 +77,7 @@ if (isset($_POST['check'])) {
array_push($error, $regErr); array_push($error, $regErr);
} }
} else { } else {
array_push($successArray, 'Admin setup complete...'); array_push($successArray, 'Administrator Account erstellt...!');
$success = true; $success = true;
$viewSubmit = true; $viewSubmit = true;
} }
@ -99,6 +99,15 @@ if (isset($_POST['check'])) {
<link rel="stylesheet" href="/css/main.css"> <link rel="stylesheet" href="/css/main.css">
</head> </head>
<body> <body>
<nav class="demo">
<a href="/setup.php" class="brand">
<span>Willkommen zu Bloggr!</span>
</a>
</nav>
<section class="main">
<h2>Seiteninformationen</h2>
<article class="card">
<header>
<p> <p>
<?php <?php
foreach($error as $err) { foreach($error as $err) {
@ -111,41 +120,40 @@ if (isset($_POST['check'])) {
</p> </p>
<form action="" method="post"> <form action="" method="post">
<div <?= ($success) ? 'style="display: none;' : '' ?>> <div <?= ($success) ? 'style="display: none;' : '' ?>>
<h2>Site info</h2>
<p> <p>
<label for="SITE_TITLE">Title</label> <label for="SITE_TITLE">Seitentitel</label>
<input type="text" name="SITE_TITLE" id="SITE_TITLE" placeholder="A Bloggr Site" value="<?= $siteTitle ?>" > <input type="text" name="SITE_TITLE" id="SITE_TITLE" placeholder="z.B. Mein Blog" value="<?= $siteTitle ?>" >
</p> </p>
<h2>Database info</h2> <h2>Datenbankinformationen</h2>
<p> <p>
<label for="DB_HOST">Host</label> <label for="DB_HOST">Host</label>
<input type="text" name="DB_HOST" id="DB_HOST" placeholder="localhost" value="<?= $dbHost ?>" > <input type="text" name="DB_HOST" id="DB_HOST" placeholder="z.B. localhost" value="<?= $dbHost ?>" >
</p> </p>
<p> <p>
<label for="DB_NAME">Database</label> <label for="DB_NAME">Datenbank</label>
<input type="text" name="DB_NAME" id="DB_NAME" placeholder="bloggr" value="<?= $dbName ?>" > <input type="text" name="DB_NAME" id="DB_NAME" placeholder="z.B. bloggr" value="<?= $dbName ?>" >
</p> </p>
<p> <p>
<label for="DB_USER">Username</label> <label for="DB_USER">Benutzername</label>
<input type="text" name="DB_USER" id="DB_USER" placeholder="bloggr" value="<?= $dbUser ?>" > <input type="text" name="DB_USER" id="DB_USER" placeholder="z.B. root" value="<?= $dbUser ?>" >
</p> </p>
<p> <p>
<label for="DB_PASS">Password</label> <label for="DB_PASS">Passwort (min. 8)</label>
<input type="password" name="DB_PASS" id="DB_PASS" placeholder="s3cur3" value="<?= $dbPass ?>" > <input type="password" name="DB_PASS" id="DB_PASS" placeholder="" value="<?= $dbPass ?>" >
</p> </p>
<br> <br>
<h2>Create administrator</h2> <h2>Administrator Konto</h2>
<p> <p>
<label for="ADMIN_USER">Username</label> <label for="ADMIN_USER">Benutzername</label>
<input type="text" name="ADMIN_USER" id="ADMIN_USER" placeholder="admin" value="<?= $user ?>" > <input type="text" name="ADMIN_USER" id="ADMIN_USER" placeholder="z.B. admin" value="<?= $user ?>" >
</p> </p>
<p> <p>
<label for="ADMIN_EMAIL">E-Mail</label> <label for="ADMIN_EMAIL">E-Mail</label>
<input type="text" name="ADMIN_EMAIL" id="ADMIN_EMAIL" placeholder="bloggr" value="<?= $email ?>" > <input type="text" name="ADMIN_EMAIL" id="ADMIN_EMAIL" placeholder="z.B. blog@example.com" value="<?= $email ?>" >
</p> </p>
<p> <p>
<label for="ADMIN_PASS">Password</label> <label for="ADMIN_PASS">Passwort </label>
<input type="password" name="ADMIN_PASS" id="ADMIN_PASS" placeholder="s3cur3" value="<?= $pass ?>" > <input type="password" name="ADMIN_PASS" id="ADMIN_PASS" placeholder="" value="<?= $pass ?>" >
</p> </p>
</div> </div>
<p> <p>
@ -154,5 +162,8 @@ if (isset($_POST['check'])) {
<?= ($viewSubmit) ? '<input type="submit" value="Submit" name="submit">' : '' ?> <?= ($viewSubmit) ? '<input type="submit" value="Submit" name="submit">' : '' ?>
</p> </p>
</form> </form>
</header>
</article>
</section>
</body> </body>
</html> </html>

View File

@ -34,8 +34,8 @@ require_once(__DIR__."/inc/head.php");
<body> <body>
<?php require_once(__DIR__."/inc/nav.php"); ?> <?php require_once(__DIR__."/inc/nav.php"); ?>
<section class="main"> <section class="main">
<?= ($view) ? '<a href="/users.php">Zurück</a>' : '' ?> <h2>Benutzer</h2>
<h2>Users</h2> <?= ($view) ? '<a href="/users.php">Zurück</a><br><br>' : '' ?>
<?php <?php
if($view) { if($view) {
$found = false; $found = false;
@ -45,9 +45,9 @@ require_once(__DIR__."/inc/head.php");
?> ?>
<form action="<?= htmlspecialchars($_SERVER['REQUEST_URI']) ?>" method="post"> <form action="<?= htmlspecialchars($_SERVER['REQUEST_URI']) ?>" method="post">
<label for="username"><?= $value['username'] ?></label><br> <label for="username"><b>Benutzername:</b> <?= $value['username'] ?></label><br>
<label for="email"><?= $value['email'] ?></label><br> <label for="email"><b>E-Mail:</b> <?= $value['email'] ?></label><br>
<label for="roles_mask">Role</label> <label for="roles_mask"><b>Rolle</b></label>
<select name="role" id="role"> <select name="role" id="role">
<option value="0" <?= ($value['roles_mask'] == 0) ? 'selected' : '' ?>>Gast</option> <option value="0" <?= ($value['roles_mask'] == 0) ? 'selected' : '' ?>>Gast</option>
<option value="1" <?= ($value['roles_mask'] == 1) ? 'selected' : '' ?>>Admin</option> <option value="1" <?= ($value['roles_mask'] == 1) ? 'selected' : '' ?>>Admin</option>