-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.php
More file actions
42 lines (40 loc) · 1.28 KB
/
dashboard.php
File metadata and controls
42 lines (40 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
session_start();
// Check if the user is logged in
if (!isset($_SESSION['username'])) {
// If not, redirect to the login page
header("Location: index.html");
exit();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Water Meter Dashboard</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<header>
<div class="user-info">
<span class="user-name"><?php echo htmlspecialchars($_SESSION['username']); ?></span>
<!-- The logout button triggers logout.php to destroy the session -->
<button class="logout-button" onclick="window.location.href = 'logout.php';">Log Out</button>
</div>
</header>
<main>
<div class="dashboard">
<?php include('status_chart.php'); ?>
<?php include('water_consumption.php'); ?>
<?php include('alarm_message.php'); ?>
</div>
<div class="device-table">
<?php include('device_table.php'); ?>
</div>
</main>
</div>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</body>
</html>