Skip to content

Instantly share code, notes, and snippets.

@okossuth
Created January 11, 2012 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save okossuth/1595073 to your computer and use it in GitHub Desktop.
Save okossuth/1595073 to your computer and use it in GitHub Desktop.
if (isset($_POST['command']))
{
echo 'Command: ' . $_POST['command'] . '<br>';
echo 'Container: ' . $_POST['container'] . '<br>';
//if(preg_match("/#/",$_POST['command']))
//{
//cmd = '';
//} else {
$cmd = '/usr/local/bin/rackspace-dir.py store --container=' . $_POST['container']' + --path=' . $_POST['command'];
echo 'fullcmd: ' . $cmd . '<br>';
//}
$command = str_replace("#","", $_POST['command']);
$exit = cmd_exec($cmd , $stdout, $stderr);
//print the output
foreach ($stdout as $line)
{
echo "$line<br>";
}
//in case there an error is returned
foreach ($stderr as $line)
{
echo "$line<br>";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment