mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Merge pull request #1412 from RaspAP/fix/sys-functions
Ajaxifies system reboot + shutdown
This commit is contained in:
21
ajax/system/sys_actions.php
Normal file
21
ajax/system/sys_actions.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
require '../../includes/csrf.php';
|
||||
|
||||
$action = escapeshellcmd($_POST['a']);
|
||||
|
||||
if (isset($action)) {
|
||||
|
||||
switch($action) {
|
||||
case "reboot":
|
||||
$response = shell_exec("sudo /sbin/reboot");
|
||||
break;
|
||||
case "shutdown":
|
||||
$response = shell_exec("sudo /sbin/shutdown -h now");
|
||||
break;
|
||||
default:
|
||||
$response = 'Unknown action: '.$action;
|
||||
}
|
||||
echo json_encode($response);
|
||||
}
|
||||
|
Reference in New Issue
Block a user