This commit is contained in:
worker committed 2026-01-26 13:36:22 +01:00
1 parent b39068ce16
commit ebb8e82c51
1 file changed
+9 -5
+9 -5
View File
@@ -1,5 +1,4 @@
<?php
// Datenbankverbindung
$servername = "testserver.blackpi.ipv64.net";
$username = "worker";
$password = "bBHofurUJWKzPE8Z";
@@ -7,12 +6,10 @@ $dbname = "DEV";
$conn = new mysqli($servername, $username, $password, $dbname);
// Verbindung prüfen
if ($conn->connect_error) {
die("Verbindung fehlgeschlagen: " . $conn->connect_error);
}
// SQL-Abfrage: Logs pro Tag zählen
$sql = "SELECT DATE(FIRST_REQUEST) as tag, COUNT(*) as anzahl FROM logs GROUP BY DATE(FIRST_REQUEST) ORDER BY DATE(FIRST_REQUEST)";
$result = $conn->query($sql);
@@ -28,6 +25,7 @@ if ($result->num_rows > 0) {
$conn->close();
?>
<!DOCTYPE html>
<html lang="de">
<head>
@@ -42,7 +40,7 @@ $conn->close();
<script>
const ctx = document.getElementById('logChart').getContext('2d');
const logChart = new Chart(ctx, {
type: 'line', // kann auch 'bar' sein
type: 'line',
data: {
labels: <?php echo json_encode($labels); ?>,
datasets: [{
@@ -51,11 +49,12 @@ const logChart = new Chart(ctx, {
borderColor: 'rgba(75, 192, 192, 1)',
backgroundColor: 'rgba(75, 192, 192, 0.2)',
fill: true,
tension: 0.2 // macht die Linie leicht geschwungen
tension: 0
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
title: {
display: true,
@@ -74,10 +73,15 @@ const logChart = new Chart(ctx, {
}
},
y: {
min: 0,
max: 300,
title: {
display: true,
text: 'Anzahl Logs'
},
ticks: {
stepSize: 20
},
beginAtZero: true
}
}