Files
uberspace-webadmin/submit.php
2015-07-13 14:29:27 +03:00

66 lines
1.5 KiB
PHP

<!DOCTYPE html>
<html lang="en-GB">
<head>
<meta charset="utf-8">
<title>UAAP | Results</title>
<link rel='stylesheet' href='/static/style.css' type='text/css' media='all' />
</head>
<body>
<div class="wrapper">
<h1>Results</h1>
<p><strong><a href="/">&#171; GO BACK</a></strong> to main administration page</p>
<table class="boxed"><tr><td>
<?php
// Reads variables of HTML form in index.php
$ACTION = $_POST['action'];
$USER = $_POST['user'];
$PASS = $_POST['pass'];
$SURE = $_POST['sure'];
// Sanitize variables
$ACTION = escapeshellarg($ACTION);
$USER = escapeshellarg($USER);
$RAND = mt_rand(100000, 999999);
$PASSFILE = '.' . $RAND . '.pass';
file_put_contents($PASSFILE, $PASS);
// Checks if checkbox is activated (default at most forms)
if($SURE == "yes")
{
// Creates full command
$command = '/bin/bash action.sh ' . $ACTION . ' ' . $USER . ' ' . $PASSFILE;
// Execute command and give output
$output = shell_exec($command);
echo "<pre>$output</pre>";
}
else
{
echo "You did not hit the necessary checkbox. Aborting.";
}
// Delete passfile
//unlink($PASSFILE);
?>
</td></tr></table>
<p>In case of errors, please check all input data again.<br />
If the problem still exists, please contact us and add the error message.</p>
</div> <!-- /wrapper -->
<div class="footer">
<p>This web application has been created by <a href="http://mehl.mx">Max Mehl</a><br />
The program can be obtained on <a href="http://src.mehl.mx/uberspace-webadmin.git">Git</a> under an AGPLv3+ license.</p>
</div>
</body>
</html>