'; return $ret; } function php_exec($com, $cwd='') { if ($cwd != '') { php_chdir($cwd); } if ($com=='') { return 0; } $root = dirname(__FILE__); $ifs=' '; $path = $root.'/bin'; $env = array('IFS' => $ifs, 'PATH' => $path); $coms = array(); $a = 0; $c = 0; $q = ''; while ($com != '') { $char = substr($com,0,1); $com = substr($com,1); if (substr_count ('\'',$char)!==0) { if (substr($q,0,1)===$char) { $q = substr($q,1); } else { $q = $char.$q; } } elseif ($q != '') { $coms[$c][$a].=$char; } elseif (substr_count ($ifs,$char)!==0) { if (isset($coms[$c][$a])) { $a++; } } elseif (substr_count (';',$char)!==0) { $c++; } else { $coms[$c][$a].=$char; } } $ret=0; foreach ($coms as $args) { $file=$path.'/'.$args[0].'.php'; if (file_exists($file)) { include($file); $ret = main($args,$env); } else { echo 'sh: command not found: `'.$args[0]."'\n"; $ret = 1; } } return $ret; }