-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
68 lines (50 loc) · 1.38 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
60
61
62
63
64
65
66
67
68
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<title>Fluebot</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
</head>
<body>
<?php
if (file_exists("switches.json")) {
$switches = json_decode(file_get_contents("switches.json"),true);
} else {
$switches = [];
}
if (isset($_GET["on"])) {
if ($_GET["on"] == "1"){
$switches["enabled"]=true;
} else {
$switches["enabled"]=false;
}
file_put_contents("switches.json", json_encode($switches));
}
if (isset($_GET["clearNightlight"])) {
$switches["nightlight"]=[];
file_put_contents("switches.json", json_encode($switches));
echo "Night light cleared.";
}
echo "<h3>Fluebot</h3>";
if ($_GET["manual"]==1) {
echo "<pre>";
include "fluebot.php";
echo "</pre>";
}
if ($_GET["status"]==1) {
echo "<pre>";
include "status.php";
echo "</pre>";
}
if ($switches["enabled"]) {
echo "<h4>Enabled.</h4>";
echo "<h4><a href=\"?on=0\">Switch off :(</a></h4>";
} else {
echo "<h4>Disabled!</h4>";
echo "<h4><a href=\"?on=1\">Switch on :3</a></h4>";
}
echo "<a href=\"?manual=1\">Manual</a>, ".
"<a href=\"?force=1&manual=1\">Force</a>, ".
"<a href=\"?status=1\">Status</a>";
?>
</body>
</html>