-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.php
More file actions
33 lines (26 loc) · 725 Bytes
/
code.php
File metadata and controls
33 lines (26 loc) · 725 Bytes
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
<?php
$code = '';
if (isset($_POST['code']) && $_POST['code'] != '') {
$code = $_POST['code'];
$_SESSION['code'] = $code;
$startTime = microtime(true);
echo '<br/>';
eval($code);
echo '<br/><br/>';
$endTime = microtime(true);
$timeDiff = $endTime - $startTime;
$timeTaken = 'Took ' . round($timeDiff, 2) . ' seconds. ';
$startTime = 0;
$endTime = 0;
} elseif (isset($_SESSION['code']) && $_SESSION['code'] != '') {
$code = $_SESSION['code'];
}
?>
<hr>
<form action="" method="post">
<textarea cols="100" rows="15" id="code" name="code"><?php echo $code ?></textarea>
<br/><br/>
<input type="submit" />
</form>
<hr>
<?= isset($timeTaken) ? $timeTaken : ''; ?>