268 lines
9.3 KiB
PHP
268 lines
9.3 KiB
PHP
<?php
|
|
$servername = "192.168.0.2";
|
|
$username = "corey";
|
|
$password = "41945549";
|
|
$dbname = "controls";
|
|
|
|
// Create connection
|
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
|
// Check connection
|
|
if ($conn->connect_error) {
|
|
die("Connection failed: " . $conn->connect_error);
|
|
}
|
|
$query = "SELECT * FROM plc ORDER BY id DESC LIMIT 1";
|
|
$result=$conn->query($query);
|
|
if ($result->num_rows > 0) {
|
|
|
|
while($row = $result->fetch_assoc()) {
|
|
|
|
echo "<div class=\"divTable\">";
|
|
echo "<div class=\"divTableBody\">";
|
|
echo "<div class=\"divTableRow\">";
|
|
|
|
if ($row [ 'test1' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test1' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test2' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test2' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test3' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test3' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test4' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test4' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test5' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test5' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test6' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test6' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test7' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test7' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test0' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test0' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test12' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test12' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
echo "</div>";
|
|
echo "<div class=\"divTableRow\">";
|
|
|
|
if ($row [ 'test1' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test1' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test2' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test2' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test3' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test3' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test4' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test4' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test5' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test5' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test6' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test6' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test7' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test7' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test0' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test0' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test12' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test12' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
echo "</div>";
|
|
echo "<div class=\"divTableRow\">";
|
|
|
|
if ($row [ 'test1' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test1' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test2' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test2' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test3' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test3' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test4' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test4' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test5' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test5' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test6' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test6' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test7' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test7' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test0' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test0' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test12' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test12' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
echo "</div>";
|
|
echo "<div class=\"divTableRow\">";
|
|
|
|
if ($row [ 'test1' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test1' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test2' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test2' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test3' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test3' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test4' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test4' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test5' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test5' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test6' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test6' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test7' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test7' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test0' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test0' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test12' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test12' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
echo "</div>";
|
|
echo "<div class=\"divTableRow\">";
|
|
|
|
if ($row [ 'test1' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test1' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test2' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test2' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test3' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test3' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test4' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test4' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test5' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test5' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test6' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test6' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test7' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test7' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test0' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test0' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
if ($row [ 'test12' ] == 1)
|
|
echo "<div class=\"divTableCell\" id=\"gopen\">ON</div>";
|
|
if ($row [ 'test12' ] == 0)
|
|
echo "<div class=\"divTableCell\" id=\"gclose\">OFF</div>";
|
|
|
|
}
|
|
|
|
}
|
|
$conn->close();
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|