diff options
author | theCalcaholic <3knoeppl@informatik.un-hamburg.de> | 2018-02-10 03:11:24 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2018-02-18 22:14:00 +0300 |
commit | f1d41e38464697da8b7acd70e03a900061b477ba (patch) | |
tree | 59839d0ae3e23072892e6f989d77dc5d669015ae /ncp-web/ncp-launcher.php | |
parent | 26afda9281cfbafba87789d395783c3b72d745c2 (diff) |
Add dialog for shutdown.v0.46.17
Diffstat (limited to 'ncp-web/ncp-launcher.php')
-rw-r--r-- | ncp-web/ncp-launcher.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ncp-web/ncp-launcher.php b/ncp-web/ncp-launcher.php index 6a0a346a..318caa7a 100644 --- a/ncp-web/ncp-launcher.php +++ b/ncp-web/ncp-launcher.php @@ -107,13 +107,21 @@ else if ( $_POST['action'] == "launch" && $_POST['config'] ) echo '"' . $ret . '" }'; } -else if ( $_POST['action'] == "poweroff" ) +else { // CSRF check $token = isset($_POST['csrf_token']) ? $_POST['csrf_token'] : ''; if ( empty($token) || !validateCSRFToken($token) ) exit( '{ "output": "Unauthorized request. Try reloading the page" }' ); - shell_exec( 'bash -c "( sleep 2 && sudo halt ) 2>/dev/null >/dev/null &"' ); + + if ( $_POST['action'] == "poweroff" ) + { + shell_exec( 'bash -c "( sleep 2 && sudo halt ) 2>/dev/null >/dev/null &"' ); + } + else if ( $_POST['action'] == "reboot" ) + { + shell_exec('bash -c "( sleep 2 && sudo reboot ) 2>/dev/null >/dev/null &"'); + } } // License |