PHP Web-UI for fifo_bridge.py

This commit is contained in:
Malte Bublitz 2023-10-15 18:41:15 +02:00
parent 1c6e8b363b
commit 8a4e851ec6
Signed by: malte70
GPG Key ID: 605DA5C729F9C184
2 changed files with 68 additions and 0 deletions

26
fifo-webui/command.php Normal file
View File

@ -0,0 +1,26 @@
<?php
$f = fopen("/tmp/mapid.fifo", "w+");
switch ($_POST["cmd"]) {
case "getty":
fwrite($f, "GETTY");
break;
case "cls":
fwrite($f, "CLS");
break;
case "line":
fwrite($f, "LINE ");
fwrite($f, $_POST["line"]);
break;
case "echo":
fwrite($f, "ECHO ");
fwrite($f, $_POST["text"]);
break;
}
fwrite($f, "\n");
fclose($f);
//header("Refresh: 5; url=./");
header("Location: ./");

42
fifo-webui/index.php Normal file
View File

@ -0,0 +1,42 @@
<?php
$Title = "MAPID-FIFO Web-UI";
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
</head>
<body>
<header>
<h1><?=$Title?></h1>
</header>
<main>
<form action="command.php" method="POST">
<input type="hidden" name="cmd" value="getty">
<button type="submit">Getty</button>
</form>
<hr>
<form action="command.php" method="POST">
<input type="hidden" name="cmd" value="cls">
<button type="submit">Clear</button>
</form>
<hr>
<form action="command.php" method="POST">
<input type="hidden" name="cmd" value="line">
<select name="line" height="1">
<option value="1">1</option>
<option value="2">2</option>
</select>
<button type="submit">Select line</button>
</form>
<hr>
<form action="command.php" method="POST">
<input type="hidden" name="cmd" value="echo">
<input type="text" name="text">
<button type="submit">Output</button>
</form>
</main>
</body>
</html>