55 lines
1.8 KiB
PHP
55 lines
1.8 KiB
PHP
<html>
|
|
<head>
|
|
<title>Administrative Tasks</title>
|
|
</head>
|
|
<body>
|
|
<h3>Admin Tasks Web Interface (v0.01 beta)</h3>
|
|
<?php
|
|
// Web Interface to the admin_tasks script
|
|
//
|
|
if(isset($_REQUEST['task']))
|
|
{
|
|
$task = $_REQUEST['task'];
|
|
if($task == '1' || $task == '2' || $task == '3' || $task == '4' ||
|
|
$task == '5' || $task == '6' || $task == '7')
|
|
{
|
|
/***********************************************************************************
|
|
Available options:
|
|
1) View system uptime
|
|
2) View logged in users
|
|
3) View crontab (current user only)
|
|
4) Backup passwd file (not working)
|
|
5) Backup shadow file (not working)
|
|
6) Backup web data (not working)
|
|
7) Backup database (not working)
|
|
|
|
NOTE: Options 4-7 are currently NOT working because they need root privileges.
|
|
I'm leaving them in the valid tasks in case I figure out a way
|
|
to securely run code as root from a PHP page.
|
|
************************************************************************************/
|
|
echo str_replace("\n", "<br />", shell_exec("/opt/scripts/admin_tasks.sh $task 2>&1"));
|
|
}
|
|
else
|
|
{
|
|
echo("Invalid task.");
|
|
}
|
|
}
|
|
?>
|
|
|
|
<p>
|
|
<h4>Select task:</p>
|
|
<form method="POST">
|
|
<select name="task">
|
|
<option value=1>View system uptime</option>
|
|
<option value=2>View logged in users</option>
|
|
<option value=3>View crontab</option>
|
|
<option value=4 disabled>Backup passwd file</option>
|
|
<option value=5 disabled>Backup shadow file</option>
|
|
<option value=6 disabled>Backup web data</option>
|
|
<option value=7 disabled>Backup database</option>
|
|
</select>
|
|
<input type="submit">
|
|
</form>
|
|
</body>
|
|
</html>
|