simple command line to browser page

this is a simple html/php page for showing commands from the line in a browser.

use it as a template for whatever you need.

<html>
<head>
<title></title>
<body>

<form method=GET>
<input type="radio" name="choice" value="1">uptime<br>
<input type="radio" name="choice" value="2">whoami<br>
<input type="radio" name="choice" value="3">df -h<br>
<input type="radio" name="choice" value="4">du -h<br>
<input type="radio" name="choice" value="5">ps -ef<br>
<input type="radio" name="choice" value="6">memory info (free -m)<br>
<input type="radio" name="choice" value="7">hostname -s<br>
<input type="radio" name="choice" value="8">ls -al<br>
<input type="submit" value="Launch">
</form>

<?php
if($_GET['choice']=="1")
        { $output = `uptime`;
        echo "<pre>$output</pre>"; }

else if($_GET['choice']=="2")
        { $output = `whoami`;
        echo "<pre>$output</pre>"; }

else if($_GET['choice']=="3")
        { $output = `df -h`;
        echo "<pre>$output</pre>"; }

else if($_GET['choice']=="4")
        { $output = `du -h`;
        echo "<pre>$output</pre>"; }

else if($_GET['choice']=="5")  
        { $output = `ps -ef`;
        echo "<pre>$output</pre>"; }

else if($_GET['choice']=="6")  
        { $output = `free -m`;
        echo "<pre>$output</pre>"; }

else if($_GET['choice']=="7")  
        { $output = `hostname -s`;
        echo "<pre>$output</pre>"; }

else if($_GET['choice']=="8")
        { $output = `ls -al`;
        echo "<pre>$output</pre>"; }
?>
«
»

    Leave a Reply

    Your email address will not be published. Required fields are marked *