Add profile picture support to account, login, and register pages
This commit is contained in:
parent
e6d70b59c3
commit
8e9246f66e
12
account.php
12
account.php
@ -27,7 +27,7 @@ if (!$conn)
|
|||||||
die("Datenbankfehler");
|
die("Datenbankfehler");
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = mysqli_prepare($conn, "SELECT userID, displayName, email FROM users WHERE userID = ? LIMIT 1");
|
$stmt = mysqli_prepare($conn, "SELECT userID, displayName, email, profilePicture FROM users WHERE userID = ? LIMIT 1");
|
||||||
if (!$stmt)
|
if (!$stmt)
|
||||||
{
|
{
|
||||||
http_response_code(500);
|
http_response_code(500);
|
||||||
@ -66,12 +66,20 @@ include 'header.php';
|
|||||||
|
|
||||||
<main class="auth" role="main">
|
<main class="auth" role="main">
|
||||||
<section class="auth__grid" aria-label="Account Bereich">
|
<section class="auth__grid" aria-label="Account Bereich">
|
||||||
|
<div class="auth__card">
|
||||||
|
<header class="auth__header">
|
||||||
|
<img src="<?php echo htmlspecialchars($user['profilePicture']); ?>"
|
||||||
|
alt="Profilbild"
|
||||||
|
width="475">
|
||||||
|
</header>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="auth__card">
|
<div class="auth__card">
|
||||||
<header class="auth__header">
|
<header class="auth__header">
|
||||||
<p class="auth__title">
|
<p class="auth__title">
|
||||||
Username: <?php echo htmlspecialchars($user['displayName'], ENT_QUOTES, 'UTF-8'); ?></p> <br>
|
Username: <?php echo htmlspecialchars($user['displayName'], ENT_QUOTES, 'UTF-8'); ?></p> <br>
|
||||||
<p class="auth__title">UserID: <?php echo (int)$user['userID']; ?></p> <br>
|
<p class="auth__title">UserID: <?php echo (int)$user['userID']; ?></p> <br>
|
||||||
<p class="auth__title">Email: <?php echo htmlspecialchars($user['email']); ?></p>
|
<p class="auth__title">Email: <?php echo htmlspecialchars($user['email']); ?></p> <br>
|
||||||
</header>
|
</header>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@ -83,7 +83,7 @@
|
|||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.auth__alert{
|
.auth__alert__error{
|
||||||
margin: 12px 0 14px;
|
margin: 12px 0 14px;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
background: var(--gh-danger);
|
background: var(--gh-danger);
|
||||||
@ -92,6 +92,15 @@
|
|||||||
box-shadow: 0 8px 18px rgba(217, 45, 32, 0.18);
|
box-shadow: 0 8px 18px rgba(217, 45, 32, 0.18);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.auth__alert__sucess{
|
||||||
|
margin: 12px 0 14px;
|
||||||
|
color: #ffffff;
|
||||||
|
background: #558346;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 10px 12px;
|
||||||
|
box-shadow: 0 8px 18px rgba(72, 142, 62, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
.auth__form{
|
.auth__form{
|
||||||
margin-top: 6px;
|
margin-top: 6px;
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
assets/images/profilePictures/admin.jpg
Normal file
BIN
assets/images/profilePictures/admin.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
BIN
assets/images/profilePictures/default.png
Normal file
BIN
assets/images/profilePictures/default.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.2 MiB |
@ -117,12 +117,12 @@ include 'header.php';
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<?php if ($loginInfo): ?>
|
<?php if ($loginInfo): ?>
|
||||||
<p class="auth__alert"
|
<p class="auth__alert__sucess"
|
||||||
role="status"><?php echo htmlspecialchars($loginInfo, ENT_QUOTES, 'UTF-8'); ?></p>
|
role="status"><?php echo htmlspecialchars($loginInfo, ENT_QUOTES, 'UTF-8'); ?></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if ($loginError): ?>
|
<?php if ($loginError): ?>
|
||||||
<p class="auth__alert"
|
<p class="auth__alert__error"
|
||||||
role="alert"><?php echo htmlspecialchars($loginError, ENT_QUOTES, 'UTF-8'); ?></p>
|
role="alert"><?php echo htmlspecialchars($loginError, ENT_QUOTES, 'UTF-8'); ?></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST')
|
|||||||
$pw2 = (string)$_POST['pw2'];
|
$pw2 = (string)$_POST['pw2'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$profilePicture = 'assets/images/profilePictures/default.png';
|
||||||
|
|
||||||
$values['email'] = $email;
|
$values['email'] = $email;
|
||||||
$values['displayName'] = $displayName;
|
$values['displayName'] = $displayName;
|
||||||
|
|
||||||
@ -124,7 +126,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST')
|
|||||||
$hash = password_hash($pw, PASSWORD_DEFAULT);
|
$hash = password_hash($pw, PASSWORD_DEFAULT);
|
||||||
$stmt = mysqli_prepare(
|
$stmt = mysqli_prepare(
|
||||||
$conn,
|
$conn,
|
||||||
'INSERT INTO users (email, passwordHash, displayName, isActive, createdAt) VALUES (?, ?, ?, 1, NOW())'
|
"INSERT INTO users (email, passwordHash, displayName, isActive, createdAt, profilePicture) VALUES (?, ?, ?, 1, NOW(), ?)"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$stmt)
|
if (!$stmt)
|
||||||
@ -133,7 +135,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mysqli_stmt_bind_param($stmt, 'sss', $email, $hash, $displayName);
|
mysqli_stmt_bind_param($stmt, 'ssss', $email, $hash, $displayName, $profilePicture);
|
||||||
$ok = mysqli_stmt_execute($stmt);
|
$ok = mysqli_stmt_execute($stmt);
|
||||||
mysqli_stmt_close($stmt);
|
mysqli_stmt_close($stmt);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user