diff --git a/public/index.php b/public/index.php
index 49e2cd7..ba9c4af 100644
--- a/public/index.php
+++ b/public/index.php
@@ -16,49 +16,63 @@
along with Foobar. If not, see .
-->
-
tmp/$uid.pdf";
- # In case you want to use an external
- # script to compile with groff:
- #$comp = "sh groff-compiler.sh";
-?>
+ exec("mkdir -p gen && rm -rf gen/*");
+ $uid = bin2hex(random_bytes(5));
+ # Configuration
+ $groff = "/usr/bin/groff";
+ $cmd = "$groff -ketpG -mspdf -Tpdf gen/$uid.ms > gen/$uid.pdf";
+ # In case you want to use an external script
+ #$cmd = "sh groff-compiler.sh";
+
+ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['codebox'])) {
+ $code = $_POST['codebox'];
+ file_put_contents("gen/$uid.ms", $code);
+ exec("$cmd");
+ }
+?>
+
+
+
Groff Web
-
-
-
-
- Groff Web
-
-
-
-
-
-