diff options
author | nachoparker <nacho@ownyourbits.com> | 2018-02-21 21:56:28 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2018-02-21 21:57:41 +0300 |
commit | 8389ac7386d6b4ad386487d9645e6c21e9656d9a (patch) | |
tree | 4a8190f463c2b5a522eaa31bc6f59032d50113ca /ncp-web | |
parent | 8d100b9d8716392ae8c845f25c2178f838dd19a7 (diff) |
ncp-web: fix backend request without argumentsv0.46.25
Diffstat (limited to 'ncp-web')
-rw-r--r-- | ncp-web/ncp-launcher.php | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/ncp-web/ncp-launcher.php b/ncp-web/ncp-launcher.php index 318caa7a..7e905e7c 100644 --- a/ncp-web/ncp-launcher.php +++ b/ncp-web/ncp-launcher.php @@ -84,15 +84,16 @@ else if ( $_POST['action'] == "launch" && $_POST['config'] ) $code = file_get_contents( $file ) or exit( '{ "output": "' . $file . ' read error" }' ); - foreach( $params as $name => $value) - { - preg_match( '/^[\w.,@_\/-]+$/' , $value , $matches ) - or exit( '{ "output": "Invalid input" , "token": "' . getCSRFToken() . '" }' ); - $code = preg_replace( '/\n' . $name . '_=.*' . PHP_EOL . '/' , - PHP_EOL . $name . '_=' . $value . PHP_EOL , - $code ) - or exit(); - } + if ( !empty( $params ) ) + foreach( $params as $name => $value ) + { + preg_match( '/^[\w.,@_\/-]+$/' , $value , $matches ) + or exit( '{ "output": "Invalid input" , "token": "' . getCSRFToken() . '" }' ); + $code = preg_replace( '/\n' . $name . '_=.*' . PHP_EOL . '/' , + PHP_EOL . $name . '_=' . $value . PHP_EOL , + $code ) + or exit(); + } file_put_contents($file, $code ) or exit( '{ "output": "' . $file . ' write error" }' ); |