diff --git a/root/opt/mailstats/html/showSummaryLogs.php b/root/opt/mailstats/html/showSummaryLogs.php new file mode 100755 index 0000000..fe8960b --- /dev/null +++ b/root/opt/mailstats/html/showSummaryLogs.php @@ -0,0 +1,116 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +// Prepare and execute the query +$sql = "SELECT * FROM SummaryLogs WHERE Date = ? AND Hour = ?"; +$stmt = $conn->prepare($sql); +$stmt->bind_param("si", $date, $hour); +$stmt->execute(); +$result = $stmt->get_result(); + +function generateLogDataTable($logData) { + $data = json_decode($logData, true); + if (is_null($data)) { + return "Invalid JSON data"; + } + + $keys = array_keys($data); + $values = array_values($data); + + $output = ''; + + // Divide keys and values into sets of 6 + $chunks = array_chunk($keys, 7); + foreach ($chunks as $chunkIndex => $chunk) { + if ($chunkIndex > 0) { + // Add spacing between different sets + #$output .= ''; + } + + $output .= ''; + foreach ($chunk as $key) { + $output .= ''; + } + $output .= ''; + foreach ($chunk as $i => $key) { + $output .= ''; + } + $output .= ''; + } + + $output .= '
' . htmlspecialchars($key) . '
' . htmlspecialchars($values[$chunkIndex * 7 + $i]) . '
'; + return $output; +} + +?> + + + + + + Summary Logs + + + +

Summary Logs for Date: and Hour:

+ + + + + + + + + + + num_rows > 0): ?> + fetch_assoc()): ?> + + + + + + + + + + + +
IdLog Data
No records found for the specified date and hour.
+ close(); + $conn->close(); + ?> + +