From 1a3e5a5bb861f59cbcdede94a82f0984e97ea002 Mon Sep 17 00:00:00 2001 From: Guillaume Mazoyer Date: Thu, 29 May 2014 14:28:48 +0200 Subject: Apache 2.4 configuration to avoid to access the config.php file. First import of the whole source code (quite monolithic for now). Update configuration example. --- execute.php | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 execute.php (limited to 'execute.php') diff --git a/execute.php b/execute.php new file mode 100644 index 0000000..e3774f0 --- /dev/null +++ b/execute.php @@ -0,0 +1,99 @@ +connect(); + $data = $router->send_command($query, $parameters); + $router->disconnect(); + + // Process the output line by line + foreach (preg_split("/((\r?\n)|(\r\n?))/", $data) as $line) { + // Get rid of empty lines + if (empty($line)) { + continue; + } + + $valid = true; + + foreach ($config['filters'] as $filter) { + // Line has been marked as invalid + if (!$valid) { + break; + } + + // Filter line based on the configuration + if (preg_match($filter, $line) === 1) { + $valid = false; + break; + } + } + + // The line is valid, print it + if ($valid) { + $return .= $line."\n"; + } + } + + // Display the result of the command + echo $return; + } +} + +// End of execute.php -- cgit v1.2.3