forked from PietsHost/Online-PHP-tester
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphp_result.php
57 lines (52 loc) · 1.43 KB
/
php_result.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
50
51
52
53
54
55
56
57
<?php
include("auth_security.php");
header('Content-Type: text/html; charset=utf-8');
error_reporting(E_ALL);
if ($_POST['submit'] != '') {
ob_start();
$theCode=ltrim(rtrim(stripslashes($_POST['code'])));
if(!strncmp($theCode,"<?",2)) //if it's full php, remove the tags
{
if(!strncmp($theCode,"<?php",5))
{
$theCode=substr($theCode,5);
}
else
{
$theCode=substr($theCode,2);
}
$theCode=substr($theCode,0,strlen($theCode)-2);
$theCode=ltrim(rtrim(stripslashes($theCode)));
}
eval($theCode);
$result = ob_get_contents();
ob_end_clean();
} else {
$result = '<p>Please input something !!</p>';
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
body{background-color:#333; font-family:'Microsoft Sans Serif',arial, sans-serif;}
legend{color:white;font-size:10px}
</style>
</head>
<body>
<fieldset style="border:1px solid black;height:300px;overflow:hidden;"><legend>Raw (+HTML entities()): </legend>
<textarea style="overflow:auto;height:200px;width:600px;background:white;padding:10px">
<?php
echo htmlentities($result);
?>
</textarea>
</fieldset>
<fieldset style="border:1px solid black;height:400px;overflow:hidden;"><legend>HTML: </legend>
<div style="overflow:auto;height:400px;background:white;padding:10px;margin:10px">
<?php
echo $result;
?>
</div>
</fieldset>
</body>
</html>