Merge pull request #1412 from RaspAP/fix/sys-functions

Ajaxifies system reboot + shutdown
This commit is contained in:
Bill Zimmerman
2023-10-09 08:42:34 +02:00
committed by GitHub
7 changed files with 80 additions and 11 deletions

View 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);
}