-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
59 lines (45 loc) · 1.19 KB
/
index.php
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Hot Water System | GTS Ltd</title>
<link rel="stylesheet" href="styles.css">
<script src="current.js"></script>
<script src="main.js"></script>
<script src="js_includes/moment.min.js"></script>
<script src="js_includes/Chart.bundle.min.js"></script>
<script>
<?php
// get the day's temperature data and put it into a JavaScript-style of array
$filename = file_get_contents('log_file_name.txt');
$csv = explode("\n", file_get_contents($filename));
foreach ($csv as $key => $line)
{
$csv[$key] = str_getcsv($line);
}
$js_array = json_encode($csv);
?>
results = <?php echo $js_array; ?>;
</script>
</head>
<body>
<div id="header">
<h1>Hot Water System Monitor </h1>
</div>
<div id="content">
<div id="body">
<h2>Current Temperatures (Celcius)</h2>
<div id="current_data">
<table id="current_readings">
</table>
</div>
<div><p id="last_date">Latest update goes here</p></div>
<h2>Today's Readings</h2>
<canvas id="results" width="400" height="400"></canvas>
</div>
</div>
<div id="footer">
<p>Copyright © 2017 Greencroft Technical Services Limited</p>
</div>
</body>
</html>