Files
scripts/Perl Ubiquiti mpower steuerung/control center/Test/index.php
2024-10-14 00:08:40 +02:00

161 lines
4.6 KiB
PHP

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<title>power.andregeissler.de</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta http-equiv="refresh" content="30">
<link rel="shortcut icon" href="images/favicon.ico">
<style type="text/css">
/* <![CDATA[ */
.onoffswitch {
position: relative; width: 100px;
-webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
}
.onoffswitch-checkbox {
display: none;
}
.onoffswitch-label {
display: block; overflow: hidden; cursor: pointer;
border: 2px solid #999999; border-radius: 20px;
}
.onoffswitch-inner {
display: block; width: 200%; margin-left: -100%;
-moz-transition: margin 0.3s ease-in 0s; -webkit-transition: margin 0.3s ease-in 0s;
-o-transition: margin 0.3s ease-in 0s; transition: margin 0.3s ease-in 0s;
}
.onoffswitch-inner:before, .onoffswitch-inner:after {
display: block; float: left; width: 50%; height: 35px; padding: 0; line-height: 35px;
font-size: 15px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
}
.onoffswitch-inner:before {
content: "AN";
padding-left: 10px;
background-color: #00FF00; color: #000000;
}
.onoffswitch-inner:after {
content: "AUS";
padding-right: 10px;
background-color: #FF0000; color: #000000;
text-align: right;
}
.onoffswitch-switch {
display: block; width: 20px; margin: 7.5px;
background: #FFFFFF;
border: 2px solid #999999; border-radius: 20px;
position: absolute; top: 0; bottom: 0; right: 61px;
-moz-transition: all 0.3s ease-in 0s; -webkit-transition: all 0.3s ease-in 0s;
-o-transition: all 0.3s ease-in 0s; transition: all 0.3s ease-in 0s;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
margin-left: 0;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
right: 0px;
}
input[type=submit] {padding:5px 10px; background:#ccc; none;
cursor:pointer;
-webkit-border-radius: 5px;
border: 2px solid #999999;
border-radius: 20px;
height: 35px;
width: 100px;
}
/* ]]> */
</style>
</head>
<body>
<?php
require "config.php";
require "func.php";
if (isset($_GET[device])) {
$name=$_GET[device];
}
if($_POST["save"] === "yes") {
$a=['', '', '', '', '', ''];
for ($i=0; $i < $switches; $i++) {
$j=$i+1;
if ($_POST["oos$j"] === "on") {
$a[$i]="checked";
}
}
for ($i=0; $i < $switches; $i++) {
$l[]=$_POST["ool$i"];
}
save("label.php", $l);
save("state.php", $a);
save("changed", "1");
file_put_contents("timer", $_POST['timerareacontent']);
}
$state = load("state.php");
$label = load("label.php");
$timerfilecontent = file_get_contents("timer");
?>
<form action="index.php?device=<?php echo $name ?>" method="post">
<table border="0" width="300px">
<tr>
<td colspan="3">
<?php print "<b>$name</b>"; ?>
</td>
</tr>
<tr>
<td>Port</td>
<td>Beschreibung</td>
<td align="center">Zustand</td>
</tr>
<?php
for ($i = 0; $i < $switches; $i++) {
$j=$i+1;
echo "
<tr>
<td>
$j
</td>
<td>
<input type='text' size='15' name='ool$i' value='$label[$i]'>
</td>
<td align='center'>
<div class='onoffswitch'>
<input type='checkbox' name='oos$j' class='onoffswitch-checkbox' id='myonoffswitch$j' $state[$i]>
<label class='onoffswitch-label' for='myonoffswitch$j'>
<span class='onoffswitch-inner'></span>
<span class='onoffswitch-switch'></span>
</label>
</div>
</td>
</tr>
";
}
?>
<tr>
<td></td><td></td>
<td align="center">
<input type="submit" value="Speichern"/>
<input type="hidden" name="device" value="<?php echo $name ?>">
<input type="hidden" name="save" value="yes">
</td>
</tr>
<tr>
<td colspan="3">
<textarea name="timerareacontent" cols="45" rows="29">
<?php echo "$timerfilecontent"; ?>
</textarea>
</td>
</tr>
</table>
</form>
<form action="/index.php" method="post" target="_top">
<input type="hidden" name="delete" value="yes">
<input type="hidden" name="path" value="<?php echo dirname(__FILE__)?>">
<input type="submit" value="Entfernen"/>
</form>
</body>
</html>