38 lines
783 B
PHP
38 lines
783 B
PHP
<?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);
|
|
}
|
|
|
|
}
|
|
|