Script execution is now done via an async js request, preventing die() and exception to mess up the entire console

This commit is contained in:
Jordi Boggiano
2010-08-31 20:47:02 +02:00
parent 300372e2d3
commit f54dc12911
5 changed files with 28 additions and 3 deletions
+9 -2
View File
@@ -48,7 +48,13 @@ if (isset($_POST['code'])) {
ob_start();
eval($code);
$debugOutput = '<div class="output">'.ob_get_clean().'</div>';
$debugOutput = ob_get_clean();
if (isset($_GET['js'])) {
header('Content-Type: text/plain');
echo $debugOutput;
die('#end-php-console-output#');
}
}
?>
@@ -63,7 +69,8 @@ if (isset($_POST['code'])) {
<script type="text/javascript" src="php-console.js"></script>
</script>
</head>
<body><?php echo $debugOutput ?>
<body>
<div class="output"><?php echo $debugOutput ?></div>
<form method="POST" action="">
<textarea cols="100" rows="20" name="code"><?php echo (isset($_POST['code']) ? htmlentities($_POST['code'], ENT_QUOTES, 'UTF-8') : null) ?></textarea>
<input type="submit" name="subm" value="Try this!" />