init III
This commit is contained in:
231
Perl control mFi/index.php
Normal file
231
Perl control mFi/index.php
Normal file
@@ -0,0 +1,231 @@
|
||||
<!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="de-DE" lang="de-DE">
|
||||
<head>
|
||||
<title>mfi.andregeissler.de</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="refresh" content="10; URL=https://mfi.andregeissler.de/">
|
||||
<style>
|
||||
INPUT {
|
||||
font-size:20px;
|
||||
}
|
||||
SPAN.tdh {
|
||||
font-size:20px;
|
||||
}
|
||||
DIV.table
|
||||
{
|
||||
display:table;
|
||||
width:1000px;
|
||||
}
|
||||
FORM.tr, DIV.tr
|
||||
{
|
||||
display:table-row;
|
||||
}
|
||||
SPAN.td1
|
||||
{
|
||||
display:table-cell;
|
||||
width:10%;
|
||||
vertical-align:middle;
|
||||
font-size:20px;
|
||||
}
|
||||
SPAN.td2
|
||||
{
|
||||
display:table-cell;
|
||||
width:25%;
|
||||
vertical-align:middle;
|
||||
font-size:20px;
|
||||
}
|
||||
SPAN.td3
|
||||
{
|
||||
display:table-cell;
|
||||
width:11%;
|
||||
vertical-align:middle;
|
||||
font-size:20px;
|
||||
}
|
||||
SPAN.td4
|
||||
{
|
||||
display:table-cell;
|
||||
width:4%;
|
||||
vertical-align:middle;
|
||||
font-size:20px;
|
||||
}
|
||||
SPAN.td5
|
||||
{
|
||||
display:table-cell;
|
||||
width:10%;
|
||||
vertical-align:middle;
|
||||
font-size:20px;
|
||||
}
|
||||
SPAN.td6
|
||||
{
|
||||
display:table-cell;
|
||||
width:15%;
|
||||
vertical-align:middle;
|
||||
padding-left:10px;
|
||||
font-size:20px;
|
||||
}
|
||||
SPAN.td7
|
||||
{
|
||||
display:table-cell;
|
||||
width:25%;
|
||||
vertical-align:middle;
|
||||
font-size:20px;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
if( $_POST["id"] != "" ) {
|
||||
$st=0;
|
||||
if ($_POST['statesw'] == "on") { $st=1; }
|
||||
$forced=0;
|
||||
if ($_POST['forced'] == "on") { $forced=1; }
|
||||
|
||||
$pdo = new PDO('mysql:host=panel.agserver.de;dbname=1_mfi', '1_mfi', 'K01v1kk0!');
|
||||
|
||||
$sql = "update port set descr='".$_POST['descr']."' where id=".$_POST['id'];
|
||||
$pdo->query($sql);
|
||||
|
||||
if ($_POST['submit'] == "speichern") {
|
||||
if ($_POST['timer'] == "") {
|
||||
$sql = "insert into queue (port_id, state, source, forced) values (".$_POST['id'].",'".$st."', 'www', ".$forced.")";
|
||||
$pdo->query($sql);
|
||||
} else {
|
||||
$sql = "insert into timer (min, port_id, state) values (".$_POST['timer'].",".$_POST['id'].",".$st.")";
|
||||
$pdo->query($sql);
|
||||
}
|
||||
} else {
|
||||
$sql = "insert into timer (min, port_id, state) values (0,".$_POST['id'].",1)";
|
||||
$pdo->query($sql);
|
||||
$sql = "insert into timer (min, port_id, state) values (".$_POST['submit'].",".$_POST['id'].",0)";
|
||||
$pdo->query($sql);
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
$pdo = new PDO('mysql:host=panel.agserver.de;dbname=1_mfi', '1_mfi', 'K01v1kk0!');
|
||||
$sql = "SELECT * FROM device";
|
||||
foreach ($pdo->query($sql) as $row) {
|
||||
echo " <div class=table>\n";
|
||||
echo " <form class=tr method=post action=index.php>\n";
|
||||
echo " <span class=tdh>".$row['name']."</span>\n";
|
||||
echo " </form>\n";
|
||||
$sql = "select * from port where dev_id = ".$row['id']." order by nr asc";
|
||||
foreach ($pdo->query($sql) as $port) {
|
||||
echo " <form class=tr method=post action=index.php>\n";
|
||||
echo " <input type=hidden name=id value=".$port['id'].">\n";
|
||||
?>
|
||||
<span class=td1><?php echo $port['nr'] ?></span>
|
||||
<span class=td2><input type=text name=descr size=13 value='<?php echo $port['descr'] ?>'></span>
|
||||
<span class=td3><input type=hidden name=state value='<?php echo $port['state'] ?>'>
|
||||
<div class='onoffswitch'>
|
||||
<input type='checkbox' name='statesw' class='onoffswitch-checkbox' id='myonoffswitch<?php echo $port['id'] ?>' <?php if ($port['state'] == 1) { echo "checked"; } ?>>
|
||||
<label class='onoffswitch-label' for='myonoffswitch<?php echo $port['id'] ?>'>
|
||||
<span class='onoffswitch-inner'></span>
|
||||
<span class='onoffswitch-switch'></span>
|
||||
</label>
|
||||
</div>
|
||||
</span>
|
||||
<span class=td4><input type=checkbox name=forced></span>
|
||||
<span class=td5><input type=text name=timer size=1></span>
|
||||
<span class=td6><input type=submit name=submit value=speichern></span>
|
||||
<span class=td7><input type=submit name=submit value=5><input type=submit name=submit value=15><input type=submit name=submit value=45></span>
|
||||
<?php
|
||||
echo " </form>\n";
|
||||
}
|
||||
echo " </div>\n";
|
||||
}
|
||||
?>
|
||||
<font size=+2>
|
||||
<hr>
|
||||
<b>Laufende Timer</b>
|
||||
<table border=0>
|
||||
<?php
|
||||
$e = 1;
|
||||
$sql = "select * from ActiveTimer";
|
||||
foreach ($pdo->query($sql) as $port) {
|
||||
if ($e == 1) {
|
||||
echo " <tr><td>Gerät</td><td>Port</td><td>Beschreibung</td><td>Restzeit</td><td>Status</td></tr>\n";
|
||||
$e = 0;
|
||||
}
|
||||
echo " <tr><td>$port[dev_name]</td><td>$port[nr]</td><td>$port[descr]</td><td>$port[min]</td><td>$port[state]</td></tr>\n";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<hr>
|
||||
<b>Aktive Cronjobs</b>
|
||||
<table border=0>
|
||||
<?php
|
||||
$e = 1;
|
||||
$sql = "select * from ActiveCronJobs";
|
||||
foreach ($pdo->query($sql) as $jobs) {
|
||||
if ($e == 1) {
|
||||
echo " <tr><td>Gerät</td><td>Port</td><td>Beschreibung</td><td>Status</td><td>Forced</td><td>Stunde</td><td>Minute</td><td>Marker</td></tr>\n";
|
||||
$e = 0;
|
||||
}
|
||||
|
||||
if ( $jobs['state'] == '1' ) {
|
||||
$bgcolor='lightgreen';
|
||||
} else {
|
||||
$bgcolor='red';
|
||||
}
|
||||
if ( $jobs['forced'] == '1' ) {
|
||||
$fbgcolor='lightgreen';
|
||||
} else {
|
||||
$fbgcolor='red';
|
||||
}
|
||||
echo " <tr><td>$jobs[Device]</td><td>$jobs[Port]</td><td>$jobs[PortDescr]</td><td bgcolor=$bgcolor>$jobs[state]</td><td bgcolor=$fbgcolor>$jobs[forced]</td><td>$jobs[hour]</td><td>$jobs[min]</td><td>$jobs[marker1], $jobs[marker2], $jobs[marker3]</td></tr>\n";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</font>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user