-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontrol.php
More file actions
43 lines (35 loc) · 801 Bytes
/
control.php
File metadata and controls
43 lines (35 loc) · 801 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
35
36
37
38
39
40
41
42
43
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Control</title>
</head>
<body>
Enable wireless
<form action="" method="post">
<input type="submit" value="on" name="active">
<input type="submit" value="off" name="active">
</form>
<?php
$json=file_get_contents("current_outputs.txt");
$out=json_decode($json,true);
if (isset($_REQUEST['active'])) {
if ($_REQUEST['active']=="on") {;
$out['active']=1;
} else {
$out['active']=0;
}
if (isset($out['count'])) {
$out['count'] = ($out['count'] + 1) & 0x7FFF;
} else {
$out['count'] = 0;
}
}
$newjson=json_encode($out);
file_put_contents("current_outputs.txt",$newjson);
echo file_get_contents("current_outputs.txt");
echo "<br>";
echo file_get_contents("current_readings.txt");
?>
</body>
</html>