-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
34 lines (33 loc) · 890 Bytes
/
index.php
File metadata and controls
34 lines (33 loc) · 890 Bytes
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
<?php
if (isset($_GET["cmd"])) {
$cmd = $_GET["cmd"];
if ($cmd != ""){
$room = $_GET["room"];
echo 'Received command ' . htmlspecialchars($cmd);
if ($room=="lr") {
if ($cmd=="off") exec("/home/pi/Desktop/ir/bin/acoff.sh");
if ($cmd=="ac") exec("/home/pi/Desktop/ir/bin/ac.sh");
if ($cmd=="heat") exec("/home/pi/Desktop/ir/bin/heat.sh");
}
else if ($room=="br") {
if (in_array($cmd, array("heat","ac","off"))){
exec("/home/pi/Desktop/ir/bin/runbrremote.sh $cmd");
}
}
header("Location: ."); /* Redirect browser */
}
print "<br>";
}
?>
<style>
h2 {font-size: 60px}
a {font-size:60px}
</style>
<h2>Living Room</h2>
<a href="?cmd=heat&room=lr">Heat</a><p>
<a href="?cmd=ac&room=lr">A/C</a><p>
<a href="?cmd=off&room=lr">Off</a><p>
<h2>Bedroom</h2>
<a href="?cmd=heat&room=br">Heat</a><p>
<a href="?cmd=ac&room=br">A/C</a><p>
<a href="?cmd=off&room=br">Off</a><p>