v1.3.1 - siehe Release Notes
This commit is contained in:
29
profil.php
29
profil.php
@@ -8,7 +8,7 @@ $message_type = '';
|
||||
$user_id = (int)$_SESSION['user_id'];
|
||||
|
||||
// Aktuelle Benutzerdaten laden
|
||||
$stmt_fetch = mysqli_prepare($conn, "SELECT username, email, role, birthday, last_birthday_year FROM users WHERE id = ?");
|
||||
$stmt_fetch = mysqli_prepare($conn, "SELECT username, email, role, birthday FROM users WHERE id = ?");
|
||||
mysqli_stmt_bind_param($stmt_fetch, "i", $user_id);
|
||||
mysqli_stmt_execute($stmt_fetch);
|
||||
$result = mysqli_stmt_get_result($stmt_fetch);
|
||||
@@ -23,7 +23,6 @@ $current_username = $user_data['username'];
|
||||
$current_email = $user_data['email'] ?? '';
|
||||
$current_role = $user_data['role'];
|
||||
$current_birthday = $user_data['birthday'] ?? '';
|
||||
$current_last_bday_year = $user_data['last_birthday_year'];
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$new_username = trim($_POST['username'] ?? '');
|
||||
@@ -76,27 +75,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$success = false;
|
||||
}
|
||||
|
||||
// 2. Optional: last_birthday_year aktualisieren
|
||||
if ($success && $update_last_bday_year) {
|
||||
$stmt2 = mysqli_prepare($conn, "UPDATE users SET last_birthday_year = ? WHERE id = ?");
|
||||
if ($stmt2) {
|
||||
mysqli_stmt_bind_param($stmt2, "ii", $new_last_bday_year, $user_id);
|
||||
if (!mysqli_stmt_execute($stmt2)) {
|
||||
$success = false;
|
||||
}
|
||||
mysqli_stmt_close($stmt2);
|
||||
} else {
|
||||
$success = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($success) {
|
||||
mysqli_commit($conn);
|
||||
$_SESSION['username'] = $new_username;
|
||||
$_SESSION['email'] = $new_email;
|
||||
|
||||
// Neu laden
|
||||
$stmt_reload = mysqli_prepare($conn, "SELECT username, email, role, birthday, last_birthday_year FROM users WHERE id = ?");
|
||||
$stmt_reload = mysqli_prepare($conn, "SELECT username, email, role, birthday FROM users WHERE id = ?");
|
||||
mysqli_stmt_bind_param($stmt_reload, "i", $user_id);
|
||||
mysqli_stmt_execute($stmt_reload);
|
||||
$user_data = mysqli_fetch_assoc(mysqli_stmt_get_result($stmt_reload));
|
||||
@@ -106,7 +91,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$current_email = $user_data['email'] ?? '';
|
||||
$current_role = $user_data['role'];
|
||||
$current_birthday = $user_data['birthday'] ?? '';
|
||||
$current_last_bday_year = $user_data['last_birthday_year'];
|
||||
|
||||
$message = "Profil erfolgreich aktualisiert!";
|
||||
$message_type = 'success';
|
||||
@@ -152,15 +136,6 @@ require_once 'inc/header.php';
|
||||
<div class="mb-3">
|
||||
<label for="birthday" class="form-label fw-bold">Geburtstag</label>
|
||||
<input type="date" class="form-control" id="birthday" name="birthday" value="<?= htmlspecialchars($current_birthday ?? '') ?>">
|
||||
<small class="form-text text-muted">
|
||||
<?php if (!empty($current_birthday) && $current_last_bday_year == date('Y')): ?>
|
||||
<span class="text-success">✓ In diesem Jahr bereits als Geburtstagszahler markiert.</span>
|
||||
<?php elseif (!empty($current_birthday)): ?>
|
||||
Geburtstag steht noch an – du kannst als Sonderzahler vorgeschlagen werden.
|
||||
<?php else: ?>
|
||||
Für automatische Sonderzahlung.
|
||||
<?php endif; ?>
|
||||
</small>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="role" class="form-label fw-bold">Rolle</label>
|
||||
|
||||
Reference in New Issue
Block a user