Add account page and update navigation links
This commit is contained in:
parent
74f6de522b
commit
abea471cf2
65
account.php
Normal file
65
account.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (empty($_SESSION['user_id'])) {
|
||||||
|
header('Location: login.php');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$userId = (int) $_SESSION['user_id'];
|
||||||
|
|
||||||
|
$servername = "localhost";
|
||||||
|
$port = 3306;
|
||||||
|
$username = "FSST";
|
||||||
|
$password = "L9wUNZZ9Qkbt";
|
||||||
|
$db = "FSST";
|
||||||
|
|
||||||
|
$conn = mysqli_connect($servername, $username, $password, $db, $port);
|
||||||
|
if (!$conn) {
|
||||||
|
http_response_code(500);
|
||||||
|
die("Datenbankfehler");
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = mysqli_prepare($conn, "SELECT userID, displayName FROM users WHERE userID = ? LIMIT 1");
|
||||||
|
if (!$stmt) {
|
||||||
|
http_response_code(500);
|
||||||
|
die("Datenbankfehler");
|
||||||
|
}
|
||||||
|
|
||||||
|
mysqli_stmt_bind_param($stmt, "i", $userId);
|
||||||
|
mysqli_stmt_execute($stmt);
|
||||||
|
|
||||||
|
$result = mysqli_stmt_get_result($stmt);
|
||||||
|
$user = $result ? mysqli_fetch_assoc($result) : null;
|
||||||
|
|
||||||
|
mysqli_stmt_close($stmt);
|
||||||
|
mysqli_close($conn);
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
session_unset();
|
||||||
|
session_destroy();
|
||||||
|
header('Location: login.php');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
include 'header.php';
|
||||||
|
?>
|
||||||
|
<link rel="stylesheet" href="assets/css/login.css">
|
||||||
|
|
||||||
|
<main class="auth" role="main">
|
||||||
|
<section class="auth__grid" aria-label="Account Bereich">
|
||||||
|
<div class="auth__card">
|
||||||
|
<header class="auth__header">
|
||||||
|
<p class="auth__title">Username: <?php echo htmlspecialchars($user['displayName'], ENT_QUOTES, 'UTF-8'); ?></p> <br>
|
||||||
|
<p class="auth__title">UserID: <?php echo (int) $user['userID']; ?></p>
|
||||||
|
</header>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<?php include 'footer.php'; ?>
|
||||||
@ -4,15 +4,15 @@
|
|||||||
|
|
||||||
:root{
|
:root{
|
||||||
/* Dunkelblauer Background, helle Cards, blaue Akzente */
|
/* Dunkelblauer Background, helle Cards, blaue Akzente */
|
||||||
--gh-bg: #0f172a;
|
--gh-bg: #151923;
|
||||||
--gh-card: #ffffff;
|
--gh-card: #1f2937;
|
||||||
--gh-text: #0f172a;
|
--gh-text: #ffffff;
|
||||||
--gh-muted: #475569;
|
--gh-muted: #ffffff;
|
||||||
--gh-border: #e5e7eb;
|
--gh-border: #5e6075;
|
||||||
|
|
||||||
--gh-primary: #2563eb;
|
--gh-primary: #274a97;
|
||||||
--gh-primary-2: #1d4ed8;
|
--gh-primary-2: #1d4ed8;
|
||||||
--gh-link: #2563eb;
|
--gh-link: #3c5fb6;
|
||||||
|
|
||||||
--gh-danger: #d92d20;
|
--gh-danger: #d92d20;
|
||||||
--gh-shadow: 0 14px 34px rgba(2, 6, 23, 0.35);
|
--gh-shadow: 0 14px 34px rgba(2, 6, 23, 0.35);
|
||||||
@ -22,24 +22,29 @@
|
|||||||
|
|
||||||
/* Wir stylen nur innerhalb des Login-Bereichs, damit global nichts kaputtgeht */
|
/* Wir stylen nur innerhalb des Login-Bereichs, damit global nichts kaputtgeht */
|
||||||
.auth{
|
.auth{
|
||||||
min-height: calc(100svh - 56px);
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
min-height: 81.5svh;
|
||||||
padding: 34px 18px 60px;
|
padding: 34px 18px 60px;
|
||||||
background: var(--gh-bg);
|
background: var(--gh-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.auth__grid{
|
.auth__grid{
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr; /* statt 1.06fr 0.94fr */
|
||||||
|
justify-items: center;
|
||||||
|
gap: 22px;
|
||||||
|
min-width: 1080px;
|
||||||
max-width: 1080px;
|
max-width: 1080px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
display: grid;
|
align-items: center; /* optional, aber passend zur Zentrierung */
|
||||||
grid-template-columns: 1.06fr 0.94fr;
|
|
||||||
gap: 22px;
|
|
||||||
align-items: start;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.auth__card,
|
.auth__card,
|
||||||
.auth__sideCard{
|
.auth__sideCard{
|
||||||
|
width: min(520px, 100%);
|
||||||
background: var(--gh-card);
|
background: var(--gh-card);
|
||||||
border: 1px solid var(--gh-border);
|
/* border: 1px solid var(--gh-border); */
|
||||||
border-radius: var(--gh-radius);
|
border-radius: var(--gh-radius);
|
||||||
box-shadow: var(--gh-shadow);
|
box-shadow: var(--gh-shadow);
|
||||||
}
|
}
|
||||||
@ -109,7 +114,7 @@
|
|||||||
padding: 12px 12px;
|
padding: 12px 12px;
|
||||||
border: 1px solid var(--gh-border);
|
border: 1px solid var(--gh-border);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
background: #ffffff;
|
background: #1e2537;
|
||||||
color: var(--gh-text);
|
color: var(--gh-text);
|
||||||
outline: none;
|
outline: none;
|
||||||
transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
|
transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
|
||||||
@ -130,7 +135,7 @@
|
|||||||
padding: 12px 14px;
|
padding: 12px 14px;
|
||||||
border: 0;
|
border: 0;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
background: linear-gradient(180deg, var(--gh-primary), var(--gh-primary-2));
|
background: var(--gh-primary);
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-weight: 750;
|
font-weight: 750;
|
||||||
letter-spacing: 0.2px;
|
letter-spacing: 0.2px;
|
||||||
@ -207,6 +212,10 @@
|
|||||||
.auth__logo{
|
.auth__logo{
|
||||||
width: 120px;
|
width: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.auth__sideCard{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 520px){
|
@media (max-width: 520px){
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 278 KiB After Width: | Height: | Size: 250 KiB |
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
<div class="nav__actions">
|
<div class="nav__actions">
|
||||||
<!-- Login link -->
|
<!-- Login link -->
|
||||||
<a class="nav__login" href="login.php" aria-label="Login">
|
<a class="nav__login" href="account.php" aria-label="Login">
|
||||||
<svg class="icon icon-user" viewBox="0 0 24 24" aria-hidden="true">
|
<svg class="icon icon-user" viewBox="0 0 24 24" aria-hidden="true">
|
||||||
<path d="M4 22C4 17.5817 7.58172 14 12 14C16.4183 14 20 17.5817 20 22H18C18 18.6863 15.3137 16 12 16C8.68629 16 6 18.6863 6 22H4ZM12 13C8.685 13 6 10.315 6 7C6 3.685 8.685 1 12 1C15.315 1 18 3.685 18 7C18 10.315 15.315 13 12 13ZM12 11C14.21 11 16 9.21 16 7C16 4.79 14.21 3 12 3C9.79 3 8 4.79 8 7C8 9.21 9.79 11 12 11Z"/>
|
<path d="M4 22C4 17.5817 7.58172 14 12 14C16.4183 14 20 17.5817 20 22H18C18 18.6863 15.3137 16 12 16C8.68629 16 6 18.6863 6 22H4ZM12 13C8.685 13 6 10.315 6 7C6 3.685 8.685 1 12 1C15.315 1 18 3.685 18 7C18 10.315 15.315 13 12 13ZM12 11C14.21 11 16 9.21 16 7C16 4.79 14.21 3 12 3C9.79 3 8 4.79 8 7C8 9.21 9.79 11 12 11Z"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
@ -71,7 +71,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
mysqli_stmt_close($stmt);
|
mysqli_stmt_close($stmt);
|
||||||
mysqli_close($conn);
|
mysqli_close($conn);
|
||||||
|
|
||||||
header("Location: index.php");
|
header("Location: account.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +90,6 @@ include 'header.php';
|
|||||||
<div class="auth__card">
|
<div class="auth__card">
|
||||||
<header class="auth__header">
|
<header class="auth__header">
|
||||||
<h2 class="auth__title">Login</h2>
|
<h2 class="auth__title">Login</h2>
|
||||||
<p class="auth__subtitle">Melde dich an, um deine Wunschliste zu verwalten und Deals schneller zu speichern.</p>
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<?php if ($loginInfo): ?>
|
<?php if ($loginInfo): ?>
|
||||||
@ -119,7 +118,6 @@ include 'header.php';
|
|||||||
|
|
||||||
<div class="auth__links">
|
<div class="auth__links">
|
||||||
<p class="auth__muted">Neu hier? <a href="register.php">Account erstellen</a></p>
|
<p class="auth__muted">Neu hier? <a href="register.php">Account erstellen</a></p>
|
||||||
<p class="auth__muted"><a href="index.php">Zurück zur Startseite</a></p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@ -118,7 +118,6 @@ include 'header.php';
|
|||||||
<div class="auth__card">
|
<div class="auth__card">
|
||||||
<header class="auth__header">
|
<header class="auth__header">
|
||||||
<h2 class="auth__title">Registrierung</h2>
|
<h2 class="auth__title">Registrierung</h2>
|
||||||
<p class="auth__subtitle">Erstelle einen Account, um deine Wunschliste zu verwalten und Deals schneller zu speichern.</p>
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<?php if ($errors): ?>
|
<?php if ($errors): ?>
|
||||||
@ -134,7 +133,7 @@ include 'header.php';
|
|||||||
<form class="auth__form" action="register.php" method="POST" autocomplete="on">
|
<form class="auth__form" action="register.php" method="POST" autocomplete="on">
|
||||||
<div class="auth__field">
|
<div class="auth__field">
|
||||||
<label for="email">E-Mail</label>
|
<label for="email">E-Mail</label>
|
||||||
<input type="email" id="email" name="email" autocomplete="email" required value="<?php echo htmlspecialchars($values['email'], ENT_QUOTES, 'UTF-8'); ?>">
|
<input type="text" id="email" name="email" autocomplete="email" required value="<?php echo htmlspecialchars($values['email'], ENT_QUOTES, 'UTF-8'); ?>">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="auth__field">
|
<div class="auth__field">
|
||||||
@ -159,7 +158,6 @@ include 'header.php';
|
|||||||
|
|
||||||
<div class="auth__links">
|
<div class="auth__links">
|
||||||
<p class="auth__muted">Schon registriert? <a href="login.php">Einloggen</a></p>
|
<p class="auth__muted">Schon registriert? <a href="login.php">Einloggen</a></p>
|
||||||
<p class="auth__muted"><a href="index.php">Zurück zur Startseite</a></p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user