Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UNIX Commands 1

Status
Not open for further replies.

peacecodotnet

Programmer
Joined
May 17, 2004
Messages
123
Location
US
I have made a PHP page where you can input a UNIX command and it will display the result. Here is the code for the ENTIRE page:

Code:
<html>
<head>
<title>Peace Co. UNIX Terminal</title>
</head>
<body>
<?php
if(! empty($_POST['command'])){

if ($_POST['command'] == "quit"){
//this i will add later
}

else {

$command = $_POST['command'];
$newline = passthru($command);


}

}

else { //---if the user hasnt yet input a command
print "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\"><input type=\"text\" name=\"command\" size=\"100\"></input><br><input type=\"submit\" value=\"Execute Command\"></input></form>";
}
?>
</body>
</html>

The problem is, when you put in a command the display comes out with bad formating. For example, I put in "LS" and it came out with a giant jumble of all the files in the current directory...not a list of them like I expected.

I've tried putting the <pre> tags around the response, that didnt work. I have just run out of ideas. What should I do?

Thanks a bunch in advance!

Peace out,
Peace Co.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top