init III
This commit is contained in:
37
Perl Ubiquiti mpower steuerung/control center/Test/api.php
Normal file
37
Perl Ubiquiti mpower steuerung/control center/Test/api.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
require "func.php";
|
||||
require "config.php";
|
||||
|
||||
if (isset($_GET["action"])) {
|
||||
# Status lesen
|
||||
if ($_GET["action"] === "getstatus") {
|
||||
$state = load('state.php');
|
||||
for ($i=0; $i<$switches; $i++) {
|
||||
$j=$i+1;
|
||||
echo "$j:'$state[$i]';";
|
||||
}
|
||||
}
|
||||
|
||||
# Last state change lesen
|
||||
if ($_GET["action"] === "getchanged") {
|
||||
if (file_exists("changed")) {
|
||||
echo "changed";
|
||||
} else {
|
||||
echo "unchanged";
|
||||
}
|
||||
unlink ("changed");
|
||||
}
|
||||
|
||||
if ($_GET["action"] === "setstatus") {
|
||||
$a=['', '', '', '', '', ''];
|
||||
for ($i=0; $i < $switches; $i++) {
|
||||
$j=$i+1;
|
||||
if ($_GET["oos$j"] === "on") {
|
||||
$a[$i]="checked";
|
||||
}
|
||||
}
|
||||
save("state.php", $a);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user