-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
66 lines (56 loc) · 1.82 KB
/
search.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
60
61
62
63
64
65
66
<html>
<head><title>Siri Automation</title></head>
<body>
<h1>
<?php
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', 1);
// get keyword
$keyword = strtolower($_GET["p"]);
$part = explode(" ", $keyword);
//echo "Part 0 ".$part[0]."<br>"; // Teil1
//echo "Part 1 ".$part[1]."<br>"; // Teil2
//echo "Part 2 ".$part[2]."<br>"; // Teil2
if($part[0] == "mach" ) {
if($part[1] == "test") {
echo "It's working";
echo "<br><br>";
}
else if($part[1] == "tv") {
if($part[2] == "an") { echo "Turning TV on..."; shell_exec("sudo pilight-send -p pollin -s 31 -u 1 -t"); }
if($part[2] == "aus") { echo "Turning TV off..."; shell_exec("sudo pilight-send -p pollin -s 31 -u 1 -f"); }
echo "<br><br>";
}
else if($part[1] == "sound") {
if($part[2] == "an") { echo "Turning Sound on..."; shell_exec("sudo pilight-send -p pollin -s 31 -u 8 -t"); }
if($part[2] == "aus") { echo "Turning Sound off..."; shell_exec("sudo pilight-send -p pollin -s 31 -u 8 -f"); }
echo "<br><br>";
}
else if($part[1] == "alles") {
if($part[2] == "aus") {
echo "Turning All off...";
shell_exec("sudo pilight-send -p pollin -s 31 -u 1 -f"); // TV
shell_exec("sudo pilight-send -p pollin -s 31 -u 8 -f"); // Sound
shell_exec("sudo pilight-send -p pollin -s 31 -u 2 -f"); // Bad Radio
shell_exec("sudo pilight-send -p rev_switch -i 60 -u A2 -f"); // Sofa Lampe
shell_exec("sudo pilight-send -p rev_switch -i 60 -u C3 -f"); // Schreibtisch Lampe
shell_exec("sudo pilight-send -p rev_switch -i 60 -u B1 -f"); // TV Lampe
}
echo "<br><br>";
}
else {
echo "Command not recognized: ". $part[1];
echo "<br> Commands: <br>";
echo "Test <br>";
echo "TV an/aus <br>";
echo "Sound an/aus <br>";
echo "Alles aus <br>";
}
}
else {
header('Location: https://search.yahoo.com/search?p=' . $keyword);
}
?>
</h1>
</body>
</html>