diff --git a/sys0-code/app/manage_user.php b/sys0-code/app/manage_user.php index ee56574..2e0a0f9 100644 --- a/sys0-code/app/manage_user.php +++ b/sys0-code/app/manage_user.php @@ -160,19 +160,20 @@ function load_user() ?> -
+
-
-
+
+

Nach Benutzer suchen, um zu verwalten

-
+
+ "); + echo(""); echo(""); echo(""); echo(""); @@ -200,7 +201,7 @@ function load_user() $search=htmlspecialchars($_GET["username"]); else $search="user_not_found"; - + $sql="SELECT COUNT(*) FROM users WHERE username LIKE '%$search%'"; $stmt = mysqli_prepare($link, $sql); mysqli_stmt_execute($stmt); @@ -280,17 +281,15 @@ function load_user() $last_id=$tid; $cnt--; } - echo(""); + // echo(""); echo(""); echo("
Nutzer
"); mysqli_close($link); ?> -
-
- diff --git a/sys0-code/app/view_log.php b/sys0-code/app/view_log.php index 5878b69..d206cfb 100644 --- a/sys0-code/app/view_log.php +++ b/sys0-code/app/view_log.php @@ -1,142 +1,191 @@ - + + + + + Log Viewer + + + - - -load_user()"; -?> - - ");?> + +
- - Log viewer - - - -
-
-
-

Alle Einträge

-
- - - - - - - - - - - - - - - - - "); - } - } - - } - fclose($fp); - ?> - -
Datum & ZeitIP AdresseTypBenutzernameInfo
------ - - - '); - echo(''); - //now get those users - $cnt2=1; - $id=0; - $last_id=0; - while($cnt2!==$cnt+1) - { - $sql = "SELECT id, username FROM users WHERE id > $last_id ORDER BY id;"; - $stmt = mysqli_prepare($link, $sql); - - mysqli_stmt_execute($stmt); - mysqli_stmt_store_result($stmt); - mysqli_stmt_bind_result($stmt, $id,$username); - mysqli_stmt_fetch($stmt); - $last_id=$id; - echo(''); - mysqli_stmt_close($stmt); - $cnt2++; - } - - - - - ?> - -
".$data[0]."".$data[1]."".$data[2]."".$data[3]."".$data[4]."
-
+
+
+
+

Log Entries

+ + +
+
+ + + + + + + + + + + + + + + + + + + + = 5) { + // Add valid log entries to an array + $log_entries[] = [ + 'date' => htmlspecialchars($data[0]), + 'ip' => htmlspecialchars($data[1]), + 'type' => htmlspecialchars($data[2]), + 'username' => htmlspecialchars($data[3]), + 'info' => htmlspecialchars($data[4]) + ]; + } + } + fclose($fp); + } + + // Reverse the log entries to display the latest first + $log_entries = array_reverse($log_entries); + + // Filter log entries by type and username + $filtered_entries = array_filter($log_entries, function ($entry) use ($type_filter, $user_filter) { + $type_match = ($type_filter === "All_types" || $entry['type'] === $type_filter); + $user_match = ($user_filter === "All_usernames" || $entry['username'] === $user_filter); + return $type_match && $user_match; + }); + + // Calculate total pages and slice the log entries for the current page + $total_entries = count($filtered_entries); + $total_pages = ceil($total_entries / $items_per_page); + $paged_entries = array_slice($filtered_entries, $offset, $items_per_page); + + // Display the filtered entries for the current page + foreach ($paged_entries as $entry) { + echo " + + + + + + "; + } + + if (empty($paged_entries)) { + echo ""; + } + ?> + + +
Date & TimeIP AddressTypeUsernameInfo
------ + + + + + +
{$entry['date']}{$entry['ip']}{$entry['type']}{$entry['username']}{$entry['info']}
No log entries found.
+
+ + + + +
+
-
+