<?php
require_once('PHPConsole.class.php');
if(isset($_POST['command']) && $_POST['command'] != ''){
PHPConsole::run($_POST['command']);
exit();
}
?>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
setTimeout(function(){
$('#submit').click(function(){
if($('#command').val() == '') return;
$.post('console.example1.php',{'command': $('#command').val()},function(r){
$('#command').val('');
});
});
$('#stop').click(function(){
$.post('console.example1.php',{'command': 'exit();'},function(r){
$('#command, #submit, #stop').hide();
$('#restart').show();
});
});
$('#restart').click(function(){
top.location.reload();
});
},1000);
</script>
<div>
<input id="command" name="command"/>
<button id="submit">Submit</button>
<button id="stop">Stop</button>
<button id="restart" style="display:none;">Start</button>
<br/>
</div>
<?php
PHPConsole::printDisplay();
?>
|