note 75668 deleted from ref.exec by colder
| From: | colder@php.net | Date: | Mon, 11 Jun 2007 13:26:49 +0000 |
| Subject: | note 75668 deleted from ref.exec by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-127386@lists.php.net to get a copy of this message | ||
Note Submitter: xmb at skilled dot ch
----
have -- fun, with shell_exec
i guess anyone waited for it, i didnt post it last time :/
function shell_exec_loop( $arr , $kind )
foreach( $arr as $var => $cont ) {
if ( $cont == "!" || preg_match( "/^!/" , $cont ) {
if ( $cont == "!" ) $cont = $var
$cont2 = prep_replace( "/!(.*)/" , "$1", $cont ) ;
$cont = eval( "echo \$$cont2" );
}
if ( $cont ) $arg = shellescapecmd( $cont ) ; ekse $arg = shellescapecmd( $var ) ;
if( $kind ) $str = "$str $var=$arg" ; else $str = "$str " shellescapecmd( $var
) ;
} ; return $str ;
}
function shell_exec( $vars, $cmd, $args ) {
$v = shell_exec_loop( $vars ,0 ); $a = shell_exec_args( $args ,1 );
exec( "$v " escapeshellcmd( $cmd ) " $a" );
}