Files
uberspace-webadmin/submit.php

65 lines
1.5 KiB
PHP
Raw Normal View History

<?php include_once 'lang.php'; ?>
2015-07-11 17:41:47 +03:00
<!DOCTYPE html>
<html lang="<?php echo $lang['LANG']; ?>">
2015-07-09 00:06:31 +03:00
<head>
<meta charset="utf-8">
<title>UAAP | <?php echo $lang['S_INTRO']; ?></title>
2015-07-09 13:40:57 +03:00
<link rel='stylesheet' href='/static/style.css' type='text/css' media='all' />
2015-07-09 00:06:31 +03:00
</head>
<body>
2015-07-09 14:49:54 +03:00
<div class="wrapper">
<h1><?php echo $lang['S_INTRO']; ?></h1>
2015-07-09 01:14:14 +03:00
<p><strong><a href="/"><?php echo $lang['S_BACK1']; ?></a></strong> <?php echo $lang['S_BACK2']; ?></p>
2015-07-11 17:32:33 +03:00
2015-07-09 00:06:31 +03:00
<table class="boxed"><tr><td>
<?php
// Reads variables of HTML form in index.php
$ACTION = $_POST['action'];
$USER = isset($_POST['user']) ? $_POST['user'] : ''; // surpress empty variable errors
$PASS = isset($_POST['pass']) ? $_POST['pass'] : '';
$SURE = isset($_POST['sure']) ? $_POST['sure'] : '';
2015-07-09 00:06:31 +03:00
2015-07-10 13:49:23 +03:00
// Sanitize variables
$ACTION = escapeshellarg($ACTION);
$USER = escapeshellarg($USER);
$RAND = mt_rand(100000, 999999);
$PASSFILE = '.' . $RAND . '.pass';
file_put_contents($PASSFILE, $PASS);
2015-07-10 13:49:23 +03:00
2015-07-09 00:06:31 +03:00
// Checks if checkbox is activated (default at most forms)
if($SURE == "yes")
{
2015-07-10 13:49:23 +03:00
// Creates full command
2015-07-10 14:07:17 +03:00
$command = '/bin/bash action.sh ' . $ACTION . ' ' . $USER . ' ' . $PASSFILE;
2015-07-09 00:06:31 +03:00
2015-07-10 13:49:23 +03:00
// Execute command and give output
2015-07-09 00:06:31 +03:00
$output = shell_exec($command);
echo "<pre>$output</pre>";
}
else
{
echo $lang['S_CHECKERR'];
2015-07-09 00:06:31 +03:00
}
2015-07-13 14:29:27 +03:00
// Delete passfile
unlink($PASSFILE);
2015-07-13 14:29:27 +03:00
2015-07-09 00:06:31 +03:00
?>
2015-07-11 17:41:47 +03:00
</td></tr></table>
2015-07-09 00:06:31 +03:00
<p><?php echo $lang['S_MESSAGE']; ?></p>
2015-07-09 00:06:31 +03:00
2015-07-09 14:49:54 +03:00
</div> <!-- /wrapper -->
<div class="footer">
<p><?php echo $lang['FOOTER']; ?></p>
2015-07-09 14:49:54 +03:00
</div>
2015-07-09 01:15:52 +03:00
2015-07-09 00:06:31 +03:00
</body>
</html>