v1.4.0 - zuletzt Aktiv hinzugefügt
This commit is contained in:
26
users.php
26
users.php
@@ -60,7 +60,7 @@ if ($is_admin && isset($_GET['action']) && $_GET['action'] == 'delete' && isset(
|
|||||||
// --- Nur Admins: Bearbeiten ---
|
// --- Nur Admins: Bearbeiten ---
|
||||||
if ($is_admin && isset($_GET['action']) && $_GET['action'] == 'edit' && isset($_GET['id'])) {
|
if ($is_admin && isset($_GET['action']) && $_GET['action'] == 'edit' && isset($_GET['id'])) {
|
||||||
$id = (int)$_GET['id'];
|
$id = (int)$_GET['id'];
|
||||||
$stmt = mysqli_prepare($conn, "SELECT id, username, email, role, birthday FROM users WHERE id = ?");
|
$stmt = mysqli_prepare($conn, "SELECT id, username, email, role, birthday, last_activity FROM users WHERE id = ?");
|
||||||
mysqli_stmt_bind_param($stmt, "i", $id);
|
mysqli_stmt_bind_param($stmt, "i", $id);
|
||||||
mysqli_stmt_execute($stmt);
|
mysqli_stmt_execute($stmt);
|
||||||
$result = mysqli_stmt_get_result($stmt);
|
$result = mysqli_stmt_get_result($stmt);
|
||||||
@@ -88,9 +88,6 @@ if ($is_admin && $_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
$email = !empty($email_raw) ? $email_raw : null;
|
$email = !empty($email_raw) ? $email_raw : null;
|
||||||
$birthday_db = deDateToDb($birthday_de);
|
$birthday_db = deDateToDb($birthday_de);
|
||||||
|
|
||||||
// --- DEBUG: Zeige, was konvertiert wurde (kannst du später löschen) ---
|
|
||||||
// error_log("DEBUG: birthday_de='$birthday_de' → birthday_db='$birthday_db'");
|
|
||||||
|
|
||||||
if (empty($username)) {
|
if (empty($username)) {
|
||||||
$message = "Benutzername ist erforderlich.";
|
$message = "Benutzername ist erforderlich.";
|
||||||
$message_type = 'danger';
|
$message_type = 'danger';
|
||||||
@@ -186,9 +183,9 @@ if ($is_admin && $_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Mitgliederliste ---
|
// --- Mitgliederliste --- 🔹 last_activity hinzugefügt
|
||||||
$users = [];
|
$users = [];
|
||||||
$result = mysqli_query($conn, "SELECT id, username, role, email, birthday FROM users ORDER BY id ASC");
|
$result = mysqli_query($conn, "SELECT id, username, role, email, birthday, last_activity FROM users ORDER BY id ASC");
|
||||||
while ($row = mysqli_fetch_assoc($result)) {
|
while ($row = mysqli_fetch_assoc($result)) {
|
||||||
$users[] = $row;
|
$users[] = $row;
|
||||||
}
|
}
|
||||||
@@ -280,6 +277,7 @@ require_once 'inc/header.php';
|
|||||||
<th class="text-center" style="width: 56px;">Daten</th>
|
<th class="text-center" style="width: 56px;">Daten</th>
|
||||||
<th>Rolle</th>
|
<th>Rolle</th>
|
||||||
<?php if ($is_admin): ?>
|
<?php if ($is_admin): ?>
|
||||||
|
<th class="text-center" style="width: 1px;"></th>
|
||||||
<th class="text-end"></th>
|
<th class="text-end"></th>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -309,6 +307,22 @@ require_once 'inc/header.php';
|
|||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<?php if ($is_admin): ?>
|
<?php if ($is_admin): ?>
|
||||||
|
<!-- 🔹 Neue Status-Spalte -->
|
||||||
|
<td class="text-center align-middle">
|
||||||
|
<?php
|
||||||
|
$is_online = !empty($user['last_activity']) && strtotime($user['last_activity']) >= strtotime('-10 minutes');
|
||||||
|
$tooltip = $is_online
|
||||||
|
? 'Online'
|
||||||
|
: (!empty($user['last_activity'])
|
||||||
|
? 'Zuletzt online: ' . date('d.m.Y H:i', strtotime($user['last_activity']))
|
||||||
|
: 'Noch nie gesehen');
|
||||||
|
$color = $is_online ? 'success' : 'secondary';
|
||||||
|
?>
|
||||||
|
<span
|
||||||
|
class="badge rounded-pill bg-<?= $color ?> d-inline-block"
|
||||||
|
title="<?= htmlspecialchars($tooltip) ?>"
|
||||||
|
style="width: 12px; height: 12px; padding: 0; border: 1px solid #555;"></span>
|
||||||
|
</td>
|
||||||
<td class="text-end align-middle">
|
<td class="text-end align-middle">
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<a href="#" class="text-secondary" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
<a href="#" class="text-secondary" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
|||||||
Reference in New Issue
Block a user