-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsave.php
More file actions
39 lines (34 loc) · 1.07 KB
/
save.php
File metadata and controls
39 lines (34 loc) · 1.07 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
<?php
if(isset($_POST['start-time']) && isset($_POST['end-time']) && isset($_POST['pin'])) {
$data = $_POST['start-time'] . "\r\n" . $_POST['end-time'] . "\r\n" . $_POST['pin'];
$ret = file_put_contents('time.txt', $data);
if($ret === false) {
echo 'There was an error writing this file';
}
else {
header('Location: index.php');
}
}
if(isset($_POST['heating-temp']) && isset($_POST['pin'])) {
$data = $_POST['heating-temp'] . "\r\n" . $_POST['pin'];
$ret = file_put_contents('heating.txt', $data);
if($ret === false) {
echo 'There was an error writing this file';
}
else {
header('Location: index.php');
}
}
if(isset($_POST['cooling-temp']) && isset($_POST['pin'])) {
$data = $_POST['cooling-temp'] . "\r\n" . $_POST['pin'];
$ret = file_put_contents('cooling.txt', $data);
if($ret === false) {
echo 'There was an error writing this file';
}
else {
header('Location: index.php');
}
}
shell_exec("pkill -f daamon.py");
shell_exec("python daemon.py > /dev/null 2>&1 &");
?>