-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
49 lines (48 loc) · 1.41 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
$code = '';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$code = $_POST['code'];
ob_start();
eval($code);
$result = ob_get_contents();
ob_end_clean();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>PHP Code Executor</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="js/jquery.ns-autogrow.min.js"></script>
<script>
$(document).ready(function () {
$('#code').autogrow({vertical: true, horizontal: false});
});
</script>
</head>
<body>
<div class="container-fluid">
<h1>PHP Code Executor</h1>
<div class="row">
<div class="col-md-6">
<h4>Code</h4>
<form method="post">
<textarea id="code" name="code" class="form-control" autofocus><?= $code?></textarea>
<button type="submit" class="btn btn-primary btn-sm">Run Code</button>
</form>
</div>
<div class="col-md-6">
<h4>Result</h4>
<?php if (isset($result)): ?>
<pre><?php echo htmlentities($result); ?></pre>
<?php endif; ?>
</div>
</div>
</div>
</body>
</html>