commit e93d938346c05f829aead9ef59febf0afa9f9403
parent a30355961b624f8ef08e2b8c02d8c2a783b6456d
Author: parazyd <parazyd@dyne.org>
Date: Sat, 6 Feb 2016 16:19:46 +0100
php for creating new tomb
Diffstat:
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/web/index.php b/web/index.php
@@ -10,8 +10,9 @@
<h3>Create new tomb and key</h3>
- <form action="tombcreate.php" method="post">
+ <form action="tomb.php?happenz=CREATE" method="post">
Username: <input type="text" name="undertaker">
+ Tomb size (MiB): <input type="number" name="size">
<select name="device">
<option selected>Choose device to store key</option>
<?php
@@ -28,7 +29,7 @@
<hr>
<h3>Change tomb's key</h3>
- <form action="newkey.php" method="post">
+ <form action="tomb.php?happenz=REVOKE" method="post">
<select name="device">
<option selected>Choose device to store key</option>
<?php
diff --git a/web/tomb.php b/web/tomb.php
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<!--
+ tomb.php - php script called by the index form, passing vars to
+ undertaker (shell middleman between web and rest of tombox
+-->
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>Creating new tomb...</title>
+</head>
+<body>
+ <?php
+ $happenz = $_GET["happenz"];
+ $username = $_POST["undertaker"];
+ $device = $_POST["device"];
+ $size = $_POST["size"];
+
+ $command = "./undertaker " . $happenz . " " . $device . " " . $username . " " . $size;
+
+ echo $command; // debug
+
+ $output = system($command, $retval);
+
+ echo $output;
+ echo "<br><br><br>" . $retval;
+ ?>
+</body>
+</html>