-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathexecute.php
More file actions
28 lines (27 loc) · 878 Bytes
/
execute.php
File metadata and controls
28 lines (27 loc) · 878 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
<?php
/**
* This code can be run on server side to execute PHP code from the interactive editor.
*
* !!! WARNING !!!
* This script allows the execution of arbitrary PHP code. Attackers could use it to compromise your servers. Only
* upload and run this script in specially protected server enviroments.
*
* Without this special knowledge to protect your server, feel free to use our endpoint: http://execute.php-einfach.de/execute.php
*
* @author: Nils Reimers, www.php-einfach.de
*/
session_start();
$code = $_POST['phpeinfach_code_compile'];
header("Access-Control-Allow-Origin: *");
ob_start();
eval(' ?>'.$code);
$output = ob_get_contents();
ob_end_clean();
if(strlen($output) > 512*1024) {
echo "<strong>Error</strong> - Output exceeded the limit. The first 1024 characters were:<br />";
echo substr($output, 0, 1024);
die();
} else {
echo $output;
}
?>